@devlab.group/agent-commerce 2.5.0 → 2.7.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.
Files changed (129) hide show
  1. package/README.md +78 -21
  2. package/dist/ap2.d.ts +19 -6
  3. package/dist/ap2.js +56 -18
  4. package/dist/ap2.js.map +1 -1
  5. package/dist/{chunk-ES3V6ECS.js → chunk-77HLISG4.js} +3 -2
  6. package/dist/chunk-77HLISG4.js.map +1 -0
  7. package/dist/{chunk-5ZYXBCDX.js → chunk-D7FPSGUQ.js} +25 -4
  8. package/dist/chunk-D7FPSGUQ.js.map +1 -0
  9. package/dist/{chunk-VUCMBGUR.js → chunk-DJRWYDKJ.js} +3 -3
  10. package/dist/{chunk-VUCMBGUR.js.map → chunk-DJRWYDKJ.js.map} +1 -1
  11. package/dist/{chunk-4K7FIBJM.js → chunk-EMKITGVV.js} +4 -4
  12. package/dist/chunk-EMKITGVV.js.map +1 -0
  13. package/dist/chunk-IWXVQYG5.js +6 -0
  14. package/dist/chunk-IWXVQYG5.js.map +1 -0
  15. package/dist/chunk-O3ACF45K.js +8 -0
  16. package/dist/chunk-O3ACF45K.js.map +1 -0
  17. package/dist/chunk-WDD2ZUR3.js +20 -0
  18. package/dist/chunk-WDD2ZUR3.js.map +1 -0
  19. package/dist/{chunk-3OTCFFFT.js → chunk-YHNTTMED.js} +7 -7
  20. package/dist/chunk-YHNTTMED.js.map +1 -0
  21. package/dist/{chunk-FKQK5XZA.js → chunk-ZSIUZPNB.js} +183 -80
  22. package/dist/chunk-ZSIUZPNB.js.map +1 -0
  23. package/dist/cli/{ap2-YAPLERSC.js → ap2-5FFGSW6F.js} +61 -25
  24. package/dist/cli/ap2-5FFGSW6F.js.map +1 -0
  25. package/dist/cli/{chunk-5K4XEAZV.js → chunk-3IEXJ7I3.js} +25 -4
  26. package/dist/cli/chunk-3IEXJ7I3.js.map +1 -0
  27. package/dist/cli/{chunk-NIU5EMSB.js → chunk-3NVJAQRO.js} +5 -5
  28. package/dist/cli/{chunk-NIU5EMSB.js.map → chunk-3NVJAQRO.js.map} +1 -1
  29. package/dist/cli/{chunk-IDY2735M.js → chunk-55AI6CLW.js} +6 -4
  30. package/dist/cli/chunk-55AI6CLW.js.map +1 -0
  31. package/dist/cli/{chunk-QA2OPHBF.js → chunk-5K2JDM4G.js} +185 -83
  32. package/dist/cli/chunk-5K2JDM4G.js.map +1 -0
  33. package/dist/cli/{chunk-QLUCNPRT.js → chunk-5TID36YG.js} +860 -170
  34. package/dist/cli/chunk-5TID36YG.js.map +1 -0
  35. package/dist/cli/{chunk-5R7DM5LM.js → chunk-66NTYSXI.js} +27 -27
  36. package/dist/cli/chunk-66NTYSXI.js.map +1 -0
  37. package/dist/cli/{chunk-VJ4EO4LE.js → chunk-6EBDOH37.js} +3 -3
  38. package/dist/cli/{chunk-VJ4EO4LE.js.map → chunk-6EBDOH37.js.map} +1 -1
  39. package/dist/cli/{chunk-4H2QLHQI.js → chunk-AGQ4U7IN.js} +5 -5
  40. package/dist/cli/chunk-AGQ4U7IN.js.map +1 -0
  41. package/dist/cli/chunk-APC5BTQM.js +6 -0
  42. package/dist/cli/chunk-APC5BTQM.js.map +1 -0
  43. package/dist/cli/{chunk-SYQLJXIU.js → chunk-C5YISPT6.js} +3 -3
  44. package/dist/cli/chunk-C5YISPT6.js.map +1 -0
  45. package/dist/cli/chunk-DKWO6LLX.js +34 -0
  46. package/dist/cli/chunk-DKWO6LLX.js.map +1 -0
  47. package/dist/cli/{chunk-SPAYKVUP.js → chunk-FL4HPCD4.js} +3 -2
  48. package/dist/cli/chunk-FL4HPCD4.js.map +1 -0
  49. package/dist/cli/{chunk-3EQBCFZY.js → chunk-H7EBJ4I3.js} +3 -3
  50. package/dist/cli/{chunk-3EQBCFZY.js.map → chunk-H7EBJ4I3.js.map} +1 -1
  51. package/dist/cli/{chunk-Z34UMZBB.js → chunk-OETKXDGA.js} +546 -175
  52. package/dist/cli/chunk-OETKXDGA.js.map +1 -0
  53. package/dist/cli/{chunk-JFVRG2HH.js → chunk-PLHPKXAT.js} +8 -8
  54. package/dist/cli/chunk-PLHPKXAT.js.map +1 -0
  55. package/dist/cli/{chunk-2UPPX3FJ.js → chunk-VSSSU4AU.js} +76 -14
  56. package/dist/cli/chunk-VSSSU4AU.js.map +1 -0
  57. package/dist/cli/chunk-ZCW56PZ3.js +8 -0
  58. package/dist/cli/{chunk-M7NXVRU5.js.map → chunk-ZCW56PZ3.js.map} +1 -1
  59. package/dist/cli/{chunk-2J2IQQ4X.js → chunk-ZFVQWOGG.js} +95 -42
  60. package/dist/cli/chunk-ZFVQWOGG.js.map +1 -0
  61. package/dist/cli/config-WT5HHDRR.js +13 -0
  62. package/dist/cli/{config-BWFMN2ZB.js.map → config-WT5HHDRR.js.map} +1 -1
  63. package/dist/cli/index.js +560 -252
  64. package/dist/cli/index.js.map +1 -1
  65. package/dist/cli/{mcp-KZEMXLHR.js → mcp-HHGNOUKE.js} +7 -7
  66. package/dist/cli/{mcp-KZEMXLHR.js.map → mcp-HHGNOUKE.js.map} +1 -1
  67. package/dist/cli/payment-providers-EWXZFBIE.js +6 -0
  68. package/dist/cli/{payment-providers-SZL36H3Y.js.map → payment-providers-EWXZFBIE.js.map} +1 -1
  69. package/dist/cli/{provider-6TKB5ADJ.js → provider-XUPLYNQ7.js} +36 -18
  70. package/dist/cli/provider-XUPLYNQ7.js.map +1 -0
  71. package/dist/cli/receipts-3DSV4DIK.js +9 -0
  72. package/dist/cli/{receipts-ZGLJWMQG.js.map → receipts-3DSV4DIK.js.map} +1 -1
  73. package/dist/cli/reconcile-GS25MQ42.js +4 -0
  74. package/dist/cli/{reconcile-IC22MJD5.js.map → reconcile-GS25MQ42.js.map} +1 -1
  75. package/dist/cli/{run-ZTYPQI4D.js → run-7KLKW3HE.js} +310 -91
  76. package/dist/cli/run-7KLKW3HE.js.map +1 -0
  77. package/dist/cli/{x402-WLYBLODI.js → x402-HP4E3QET.js} +11 -10
  78. package/dist/cli/x402-HP4E3QET.js.map +1 -0
  79. package/dist/{guardrails-CX_jYXvZ.d.ts → guardrails-CeyLS1ou.d.ts} +2 -2
  80. package/dist/index.d.ts +119 -206
  81. package/dist/index.js +1703 -427
  82. package/dist/index.js.map +1 -1
  83. package/dist/logger-CllGwQ8i.d.ts +19 -0
  84. package/dist/mcp.d.ts +3 -1
  85. package/dist/mcp.js +4 -3
  86. package/dist/mcp.js.map +1 -1
  87. package/dist/mpp.d.ts +2 -1
  88. package/dist/mpp.js +32 -13
  89. package/dist/mpp.js.map +1 -1
  90. package/dist/{protocol-adapter-DEXpdp8m.d.ts → protocol-adapter-DdFL5LBU.d.ts} +15 -132
  91. package/dist/{runtime-Dz2fSO-P.d.ts → runtime-BmaSp2Ce.d.ts} +36 -23
  92. package/dist/store-BVvMzpuV.d.ts +389 -0
  93. package/dist/testing.d.ts +51 -0
  94. package/dist/testing.js +2050 -0
  95. package/dist/testing.js.map +1 -0
  96. package/dist/transaction-BXXJltZ-.d.ts +129 -0
  97. package/dist/{types-j7MnUXYN.d.ts → types-DWqjz81-.d.ts} +5 -2
  98. package/dist/x402.d.ts +9 -3
  99. package/dist/x402.js +7 -5
  100. package/dist/x402.js.map +1 -1
  101. package/package.json +17 -29
  102. package/dist/chunk-3OTCFFFT.js.map +0 -1
  103. package/dist/chunk-4K7FIBJM.js.map +0 -1
  104. package/dist/chunk-5ZYXBCDX.js.map +0 -1
  105. package/dist/chunk-ES3V6ECS.js.map +0 -1
  106. package/dist/chunk-FKQK5XZA.js.map +0 -1
  107. package/dist/cli/ap2-YAPLERSC.js.map +0 -1
  108. package/dist/cli/chunk-2J2IQQ4X.js.map +0 -1
  109. package/dist/cli/chunk-2UPPX3FJ.js.map +0 -1
  110. package/dist/cli/chunk-4H2QLHQI.js.map +0 -1
  111. package/dist/cli/chunk-5K4XEAZV.js.map +0 -1
  112. package/dist/cli/chunk-5R7DM5LM.js.map +0 -1
  113. package/dist/cli/chunk-FHCFR2GS.js +0 -17
  114. package/dist/cli/chunk-FHCFR2GS.js.map +0 -1
  115. package/dist/cli/chunk-IDY2735M.js.map +0 -1
  116. package/dist/cli/chunk-JFVRG2HH.js.map +0 -1
  117. package/dist/cli/chunk-M7NXVRU5.js +0 -8
  118. package/dist/cli/chunk-QA2OPHBF.js.map +0 -1
  119. package/dist/cli/chunk-QLUCNPRT.js.map +0 -1
  120. package/dist/cli/chunk-SPAYKVUP.js.map +0 -1
  121. package/dist/cli/chunk-SYQLJXIU.js.map +0 -1
  122. package/dist/cli/chunk-Z34UMZBB.js.map +0 -1
  123. package/dist/cli/config-BWFMN2ZB.js +0 -12
  124. package/dist/cli/payment-providers-SZL36H3Y.js +0 -6
  125. package/dist/cli/provider-6TKB5ADJ.js.map +0 -1
  126. package/dist/cli/receipts-ZGLJWMQG.js +0 -8
  127. package/dist/cli/reconcile-IC22MJD5.js +0 -4
  128. package/dist/cli/run-ZTYPQI4D.js.map +0 -1
  129. package/dist/cli/x402-WLYBLODI.js.map +0 -1
@@ -1,6 +1,8 @@
1
- import { SETTLE_AFTER_BACKEND_METADATA_KEY, REUSE_REJECTED_AUTHORIZATION_METADATA_KEY, canonicalJson } from './chunk-5R7DM5LM.js';
2
- import { RESERVED_INPUT_FIELDS, NOOP_LOGGER, DEFAULT_BACKEND_TIMEOUT_MS, RECONCILIATION_METADATA_KEY } from './chunk-IDY2735M.js';
3
- import { CommerceError, isCommerceError, describeError, toCommerceError } from './chunk-SYQLJXIU.js';
1
+ import { hasMethodGroup } from './chunk-DKWO6LLX.js';
2
+ import { PAYMENT_KEY_ENDPOINT_PREFIX } from './chunk-APC5BTQM.js';
3
+ import { SETTLE_AFTER_BACKEND_METADATA_KEY, REUSE_REJECTED_AUTHORIZATION_METADATA_KEY, canonicalJson } from './chunk-66NTYSXI.js';
4
+ import { RESERVED_INPUT_FIELDS, NOOP_LOGGER, DEFAULT_BACKEND_TIMEOUT_MS, RECONCILIATION_METADATA_KEY } from './chunk-55AI6CLW.js';
5
+ import { CommerceError, isCommerceError, describeError, toCommerceError } from './chunk-C5YISPT6.js';
4
6
  import { isRecord } from './chunk-3M6U7ILB.js';
5
7
  import { createHash } from 'crypto';
6
8
  import { isDeepStrictEqual } from 'util';
@@ -8,6 +10,374 @@ import { isDeepStrictEqual } from 'util';
8
10
  // src/config/filename.ts
9
11
  var DEFAULT_CONFIG_FILENAME = "config.yaml";
10
12
 
13
+ // src/protocols/acp/constants.ts
14
+ var ACP_SPEC_VERSION = "2026-04-17";
15
+ var ACP_API_VERSION = "2026-04-17";
16
+ var ACP_WELL_KNOWN_PATH = "/.well-known/acp.json";
17
+ var ACP_CHECKOUT_OPERATIONS = [
18
+ "createCheckoutSession",
19
+ "updateCheckoutSession",
20
+ "getCheckoutSession",
21
+ "completeCheckoutSession",
22
+ "cancelCheckoutSession"
23
+ ];
24
+ var ACP_OPERATION_INPUT_KEYS = {
25
+ createCheckoutSession: ["body"],
26
+ updateCheckoutSession: ["path", "body"],
27
+ getCheckoutSession: ["path"],
28
+ completeCheckoutSession: ["path", "body"],
29
+ cancelCheckoutSession: ["path"]
30
+ };
31
+ var ACP_OPERATION_OPTIONAL_INPUT_KEYS = {
32
+ cancelCheckoutSession: ["body"]
33
+ };
34
+ var ACP_SESSION_ID_INPUT_KEY = "checkout_session_id";
35
+ var ACP_JSON_MEDIA_TYPE = "application/json";
36
+ var ACP_API_VERSION_HEADER = "api-version";
37
+ var ACP_REQUEST_ID_HEADER = "request-id";
38
+ var ACP_IDEMPOTENCY_KEY_HEADER = "idempotency-key";
39
+ var ACP_IDEMPOTENT_REPLAYED_HEADER = "idempotent-replayed";
40
+ var ACP_IN_FLIGHT_RETRY_AFTER_SECONDS = 1;
41
+ var ACP_MAX_REQUEST_ID_LENGTH = 128;
42
+ var ACP_FORWARDED_HEADERS = [
43
+ "accept-language",
44
+ "user-agent",
45
+ ACP_REQUEST_ID_HEADER,
46
+ ACP_API_VERSION_HEADER,
47
+ "signature",
48
+ "timestamp"
49
+ ];
50
+ var ACP_MAX_FORWARDED_HEADER_LENGTH = 2048;
51
+ var ACP_MERCHANT_RETRY_AFTER_DEFAULT_SECONDS = 5;
52
+ var ACP_MERCHANT_RETRY_AFTER_MAX_SECONDS = 300;
53
+ function createFlow(request, transactionId) {
54
+ return { request, transactionId, persistenceFailures: [], journaled: false, chargeRisk: false };
55
+ }
56
+ function failuresOf(flow) {
57
+ return flow.persistenceFailures.length > 0 ? { persistenceFailures: [...flow.persistenceFailures] } : {};
58
+ }
59
+ function sha256(text) {
60
+ return `sha256:${createHash("sha256").update(text, "utf8").digest("hex")}`;
61
+ }
62
+ function inputDigest(input) {
63
+ const json = canonicalJson(input);
64
+ return json !== void 0 ? sha256(json) : void 0;
65
+ }
66
+ function configDigest(resource, requirement) {
67
+ const terms = {
68
+ resourceId: resource.id,
69
+ pricing: resource.pricing,
70
+ paymentMethods: resource.paymentMethods,
71
+ authorization: resource.authorization?.required ?? [],
72
+ requirement: {
73
+ provider: requirement.provider,
74
+ amount: requirement.amount,
75
+ currency: requirement.currency,
76
+ destination: requirement.destination ?? null,
77
+ network: requirement.network ?? null,
78
+ asset: requirement.asset ?? null,
79
+ settleAfterBackend: requirement.metadata?.[SETTLE_AFTER_BACKEND_METADATA_KEY] === true
80
+ }
81
+ };
82
+ return sha256(canonicalJson(terms) ?? JSON.stringify(terms));
83
+ }
84
+ function newTransaction(flow, resource, requirement, verification, digest, authorization) {
85
+ const raw = verification.metadata?.[RECONCILIATION_METADATA_KEY];
86
+ const locator = isRecord(raw) ? raw : void 0;
87
+ const expiresAt = typeof locator?.["expiresAt"] === "string" ? locator["expiresAt"] : void 0;
88
+ const network = verification.network ?? requirement.network;
89
+ const asset = verification.asset ?? requirement.asset;
90
+ return {
91
+ id: flow.transactionId,
92
+ protocol: flow.request.protocol,
93
+ ...network !== void 0 ? { network } : {},
94
+ ...asset !== void 0 ? { asset } : {},
95
+ ...locator !== void 0 ? { locator } : {},
96
+ ...expiresAt !== void 0 ? { expiresAt } : {},
97
+ ...authorization !== void 0 ? { authorization } : {},
98
+ ...digest !== void 0 ? { inputDigest: digest } : {},
99
+ configDigest: configDigest(resource, requirement)
100
+ };
101
+ }
102
+ function sha256Hex(text) {
103
+ return createHash("sha256").update(text).digest("hex");
104
+ }
105
+ function paidOperationKey(operation) {
106
+ const { deployment, resourceId, replayKey, inputDigest: digest, clientKey, payer } = operation;
107
+ if (digest === void 0) return void 0;
108
+ const identity = clientKey && payer ? `retry:${sha256Hex(clientKey)}:${payer}` : replayKey;
109
+ return sha256Hex(JSON.stringify(["paid-operation", deployment, resourceId, identity, digest]));
110
+ }
111
+
112
+ // src/core/execution/pipeline/retry.ts
113
+ var MAX_REDELIVERY_RETENTION_HOURS = 8760;
114
+ var IN_FLIGHT_RETRY_AFTER_SECONDS = 1;
115
+ var REFUSALS = {
116
+ conflict: {
117
+ reason: "payment_identifier_conflict",
118
+ message: "This payment identifier belongs to another request"
119
+ },
120
+ "in-flight": {
121
+ reason: "payment_identifier_in_flight",
122
+ message: "A request with this payment identifier is in progress"
123
+ },
124
+ unresolved: {
125
+ reason: "payment_identifier_unresolved",
126
+ message: "The earlier request with this payment identifier may have been charged and has no stored response"
127
+ }
128
+ };
129
+ function assertRetrySupport(resource, store, deployment, requestId) {
130
+ const { merchantKey, redelivery } = resource.idempotency ?? {};
131
+ if (merchantKey !== true && redelivery === void 0) return void 0;
132
+ const invalid = (message) => new CommerceError("CONFIG_INVALID", message, {
133
+ ...requestId !== void 0 ? { requestId } : {},
134
+ resourceId: resource.id
135
+ });
136
+ const unsupported = (needs) => invalid(`Resource "${resource.id}" sets idempotency, which requires ${needs}`);
137
+ const hours = redelivery?.retentionHours;
138
+ if (hours !== void 0 && !(Number.isInteger(hours) && hours >= 1 && hours <= MAX_REDELIVERY_RETENTION_HOURS)) {
139
+ throw invalid(
140
+ `Resource "${resource.id}" sets idempotency.redelivery.retentionHours outside 1 to ${MAX_REDELIVERY_RETENTION_HOURS}`
141
+ );
142
+ }
143
+ if (deployment === void 0) throw unsupported("the pipeline's deployment option");
144
+ if (redelivery === void 0) return { deployment };
145
+ if (!hasMethodGroup(store, "idempotency_claims") || !hasMethodGroup(store, "response_redelivery")) {
146
+ throw unsupported("a store with idempotency claims and getIdempotencyKey");
147
+ }
148
+ return { deployment, store };
149
+ }
150
+ function createRetryGate(ctx) {
151
+ const { options, safeEmit, safePersist, buildEvent } = ctx;
152
+ async function open(flow, resource, provider, validInput, support, pipelineStart) {
153
+ const { request } = flow;
154
+ const retentionHours = resource.idempotency?.redelivery?.retentionHours;
155
+ const { payment } = request;
156
+ if (support?.store === void 0 || retentionHours === void 0 || payment === void 0) {
157
+ return void 0;
158
+ }
159
+ const clientKey = request.retryKey ?? await providerRetryKey(flow, resource, provider, payment);
160
+ if (clientKey === void 0) return void 0;
161
+ const fingerprint = inputDigest(validInput);
162
+ if (fingerprint === void 0) {
163
+ throw await rejected(
164
+ flow,
165
+ resource,
166
+ provider,
167
+ new CommerceError(
168
+ "INPUT_INVALID",
169
+ `Input for resource "${resource.id}" is not I-JSON, so a retry key cannot identify it`,
170
+ { requestId: request.requestId, resourceId: resource.id }
171
+ )
172
+ );
173
+ }
174
+ const { store } = support;
175
+ const { authorization } = request;
176
+ const ticket = {
177
+ kind: "retry",
178
+ store,
179
+ scope: {
180
+ deployment: support.deployment,
181
+ endpoint: `${PAYMENT_KEY_ENDPOINT_PREFIX}${resource.id}`,
182
+ key: sha256Hex(clientKey)
183
+ },
184
+ fingerprint,
185
+ expiresAt: new Date(
186
+ options.clock.now().getTime() + retentionHours * 60 * 60 * 1e3
187
+ ).toISOString(),
188
+ clientKey,
189
+ proofDigest: sha256Hex(`${payment.method}:${payment.payload}`),
190
+ ...authorization !== void 0 ? { authorizationDigest: sha256Hex(`${authorization.method}:${authorization.payload}`) } : {}
191
+ };
192
+ const existing = await reading(
193
+ flow,
194
+ resource,
195
+ () => store.getIdempotencyKey(ticket.scope, fingerprint)
196
+ );
197
+ if (existing?.kind === "in-flight" || existing?.kind === "unresolved") {
198
+ if (existing.owner !== ticket.proofDigest) return ticket;
199
+ throw await refusal(flow, resource, provider, existing.kind);
200
+ }
201
+ if (existing?.kind !== "replay") return ticket;
202
+ const stored = readStoredDelivery(existing.body);
203
+ return stored?.proofDigest === ticket.proofDigest && authorizes(resource, stored, ticket) ? redeliver(flow, resource, provider, existing.status, stored, pipelineStart) : ticket;
204
+ }
205
+ async function claim(flow, resource, provider, ticket, verification, pipelineStart) {
206
+ const { scope, fingerprint, expiresAt, proofDigest } = ticket;
207
+ const claimed = await reading(
208
+ flow,
209
+ resource,
210
+ () => ticket.store.claimIdempotencyKey(scope, fingerprint, expiresAt, proofDigest)
211
+ );
212
+ const replay = await acceptOrRefuse(flow, resource, provider, claimed);
213
+ if (replay === void 0) return void 0;
214
+ const stored = await storedDelivery(flow, resource, provider, replay);
215
+ const samePayer = verification.payer !== void 0 && verification.payer === stored.payer;
216
+ if (!samePayer || !authorizes(resource, stored, ticket)) {
217
+ throw await refusal(flow, resource, provider, "conflict");
218
+ }
219
+ return redeliver(flow, resource, provider, replay.status, stored, pipelineStart);
220
+ }
221
+ async function finishDelivered(flow, ticket, verification, response, receipt) {
222
+ const contentType = response.headers["content-type"];
223
+ const stored = {
224
+ proofDigest: ticket.proofDigest,
225
+ ...ticket.authorizationDigest !== void 0 ? { authorizationDigest: ticket.authorizationDigest } : {},
226
+ // Record the verified buyer; settlement may name a fee payer instead
227
+ ...verification.payer !== void 0 ? { payer: verification.payer } : {},
228
+ // Keep only Content-Type; never persist a backend Set-Cookie header
229
+ ...contentType !== void 0 ? { contentType } : {},
230
+ body: response.body ?? null,
231
+ receiptId: receipt.id
232
+ };
233
+ const receiptSaved = !flow.persistenceFailures.includes("receipt");
234
+ const update = { kind: "completed", status: response.status, body: stored };
235
+ if (receiptSaved && await write(flow, ticket, update)) return;
236
+ if (!flow.persistenceFailures.includes("response")) flow.persistenceFailures.push("response");
237
+ await write(flow, ticket, { kind: "unresolved" });
238
+ }
239
+ async function finishFailed(flow, ticket) {
240
+ await write(flow, ticket, { kind: flow.chargeRisk ? "unresolved" : "released" });
241
+ }
242
+ function write(flow, ticket, update) {
243
+ return safePersist(
244
+ flow,
245
+ () => ticket.store.updateIdempotencyKey(ticket.scope, update),
246
+ `updateIdempotencyKey(${update.kind})`,
247
+ "response"
248
+ );
249
+ }
250
+ async function reading(flow, resource, read) {
251
+ try {
252
+ return await read();
253
+ } catch (error) {
254
+ throw new CommerceError("STORAGE_ERROR", "Payment retry state could not be read", {
255
+ requestId: flow.request.requestId,
256
+ resourceId: resource.id,
257
+ cause: error
258
+ });
259
+ }
260
+ }
261
+ async function acceptOrRefuse(flow, resource, provider, claimed) {
262
+ if (claimed === void 0 || claimed.kind === "reserved") return void 0;
263
+ if (claimed.kind === "replay") return claimed;
264
+ throw await refusal(flow, resource, provider, claimed.kind);
265
+ }
266
+ async function storedDelivery(flow, resource, provider, replay) {
267
+ const stored = readStoredDelivery(replay.body);
268
+ if (stored === void 0) throw await refusal(flow, resource, provider, "unresolved");
269
+ return stored;
270
+ }
271
+ function refusal(flow, resource, provider, kind) {
272
+ const { reason, message } = REFUSALS[kind];
273
+ const inFlight = kind === "in-flight";
274
+ return rejected(
275
+ flow,
276
+ resource,
277
+ provider,
278
+ new CommerceError("PAYMENT_REPLAYED", message, {
279
+ requestId: flow.request.requestId,
280
+ resourceId: resource.id,
281
+ details: {
282
+ reason,
283
+ ...inFlight ? { retryAfterSeconds: IN_FLIGHT_RETRY_AFTER_SECONDS } : {}
284
+ },
285
+ ...inFlight ? { retryable: true } : {}
286
+ })
287
+ );
288
+ }
289
+ async function rejected(flow, resource, provider, error) {
290
+ const reason = error.details?.["reason"];
291
+ await safeEmit(
292
+ buildEvent(flow, {
293
+ type: "payment.rejected",
294
+ resourceId: resource.id,
295
+ adapter: flow.request.protocol,
296
+ paymentProvider: provider.name,
297
+ status: "error",
298
+ data: { reason: typeof reason === "string" ? reason : error.code }
299
+ })
300
+ );
301
+ if (error.requestId !== void 0) return error;
302
+ return new CommerceError(error.code, error.message, {
303
+ requestId: flow.request.requestId,
304
+ resourceId: error.resourceId ?? resource.id,
305
+ httpStatus: error.httpStatus,
306
+ retryable: error.retryable,
307
+ ...error.details !== void 0 ? { details: error.details } : {},
308
+ ...error.cause !== void 0 ? { cause: error.cause } : {}
309
+ });
310
+ }
311
+ async function providerRetryKey(flow, resource, provider, submission) {
312
+ try {
313
+ return provider.retryKey?.({ resource, submission });
314
+ } catch (error) {
315
+ const typed = isCommerceError(error) ? error : new CommerceError("PAYMENT_PROVIDER_UNAVAILABLE", "Payment provider is unavailable", {
316
+ cause: error
317
+ });
318
+ throw await rejected(flow, resource, provider, typed);
319
+ }
320
+ }
321
+ async function redeliver(flow, resource, provider, status, stored, pipelineStart) {
322
+ const { request } = flow;
323
+ const receipt = await reading(flow, resource, () => options.store.getReceipt(stored.receiptId));
324
+ if (receipt?.payment === void 0) {
325
+ throw await refusal(flow, resource, provider, "unresolved");
326
+ }
327
+ const durationMs = Math.round(options.clock.monotonicMs() - pipelineStart);
328
+ const original = receipt.transactionId;
329
+ await safeEmit(
330
+ buildEvent(flow, {
331
+ type: "resource.delivered",
332
+ resourceId: resource.id,
333
+ adapter: request.protocol,
334
+ status: "ok",
335
+ durationMs,
336
+ data: {
337
+ redelivered: true,
338
+ ...original !== void 0 ? { originalTransactionId: original } : {}
339
+ }
340
+ })
341
+ );
342
+ return {
343
+ kind: "delivered",
344
+ requestId: request.requestId,
345
+ transactionId: flow.transactionId,
346
+ resourceId: resource.id,
347
+ backendStatus: status,
348
+ body: stored.body,
349
+ headers: stored.contentType !== void 0 ? { "content-type": stored.contentType } : {},
350
+ payment: receipt.payment,
351
+ receipt,
352
+ durationMs,
353
+ redelivered: true
354
+ };
355
+ }
356
+ return { open, claim, finishDelivered, finishFailed };
357
+ }
358
+ function authorizes(resource, stored, ticket) {
359
+ if ((resource.authorization?.required.length ?? 0) === 0) return true;
360
+ return stored.authorizationDigest !== void 0 && stored.authorizationDigest === ticket.authorizationDigest;
361
+ }
362
+ function readStoredDelivery(value) {
363
+ if (!isRecord(value) || !Object.hasOwn(value, "body")) return void 0;
364
+ const { proofDigest, authorizationDigest, payer, contentType, body, receiptId } = value;
365
+ if (typeof proofDigest !== "string" || typeof receiptId !== "string") return void 0;
366
+ if (authorizationDigest !== void 0 && typeof authorizationDigest !== "string") {
367
+ return void 0;
368
+ }
369
+ if (payer !== void 0 && typeof payer !== "string") return void 0;
370
+ if (contentType !== void 0 && typeof contentType !== "string") return void 0;
371
+ return {
372
+ proofDigest,
373
+ ...authorizationDigest !== void 0 ? { authorizationDigest } : {},
374
+ ...payer !== void 0 ? { payer } : {},
375
+ ...contentType !== void 0 ? { contentType } : {},
376
+ body,
377
+ receiptId
378
+ };
379
+ }
380
+
11
381
  // src/core/execution/backend-request.ts
12
382
  var NEVER_FORWARDED_HEADER = /^(authorization|cookie|set-cookie|host|content-length|content-type|connection|keep-alive|te|trailer|transfer-encoding|upgrade|idempotency-key|proxy-.*)$/;
13
383
  var PATH_PARAM_PATTERN = /\{([a-zA-Z0-9_.-]+)\}/g;
@@ -354,56 +724,6 @@ function safeStringify(value) {
354
724
  function isAbortError(error) {
355
725
  return error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError");
356
726
  }
357
- function createFlow(request, transactionId) {
358
- return { request, transactionId, persistenceFailures: [], journaled: false };
359
- }
360
- function failuresOf(flow) {
361
- return flow.persistenceFailures.length > 0 ? { persistenceFailures: [...flow.persistenceFailures] } : {};
362
- }
363
- function sha256(text) {
364
- return `sha256:${createHash("sha256").update(text, "utf8").digest("hex")}`;
365
- }
366
- function inputDigest(input) {
367
- const json = canonicalJson(input);
368
- return json !== void 0 ? sha256(json) : void 0;
369
- }
370
- function configDigest(resource, requirement) {
371
- const terms = {
372
- resourceId: resource.id,
373
- pricing: resource.pricing,
374
- paymentMethods: resource.paymentMethods,
375
- authorization: resource.authorization?.required ?? [],
376
- requirement: {
377
- provider: requirement.provider,
378
- amount: requirement.amount,
379
- currency: requirement.currency,
380
- destination: requirement.destination ?? null,
381
- network: requirement.network ?? null,
382
- asset: requirement.asset ?? null,
383
- settleAfterBackend: requirement.metadata?.[SETTLE_AFTER_BACKEND_METADATA_KEY] === true
384
- }
385
- };
386
- return sha256(canonicalJson(terms) ?? JSON.stringify(terms));
387
- }
388
- function newTransaction(flow, resource, requirement, verification, validInput, authorization) {
389
- const raw = verification.metadata?.[RECONCILIATION_METADATA_KEY];
390
- const locator = isRecord(raw) ? raw : void 0;
391
- const expiresAt = typeof locator?.["expiresAt"] === "string" ? locator["expiresAt"] : void 0;
392
- const network = verification.network ?? requirement.network;
393
- const asset = verification.asset ?? requirement.asset;
394
- const digest = inputDigest(validInput);
395
- return {
396
- id: flow.transactionId,
397
- protocol: flow.request.protocol,
398
- ...network !== void 0 ? { network } : {},
399
- ...asset !== void 0 ? { asset } : {},
400
- ...locator !== void 0 ? { locator } : {},
401
- ...expiresAt !== void 0 ? { expiresAt } : {},
402
- ...authorization !== void 0 ? { authorization } : {},
403
- ...digest !== void 0 ? { inputDigest: digest } : {},
404
- configDigest: configDigest(resource, requirement)
405
- };
406
- }
407
727
  var SUPPORTED_TYPES = /* @__PURE__ */ new Set([
408
728
  "object",
409
729
  "string",
@@ -647,10 +967,12 @@ function retryChallenge(requirement, reason) {
647
967
  };
648
968
  }
649
969
  var FINISHED_ATTEMPT_STATUSES = /* @__PURE__ */ new Set(["settled", "rejected"]);
970
+ function isFinishedAttempt(status) {
971
+ return typeof status === "string" && FINISHED_ATTEMPT_STATUSES.has(status);
972
+ }
650
973
  function replayError(error, requirement) {
651
974
  if (error.code !== "PAYMENT_REPLAYED") return error;
652
- const status = error.details?.["attemptStatus"];
653
- const finished = typeof status === "string" && FINISHED_ATTEMPT_STATUSES.has(status);
975
+ const finished = isFinishedAttempt(error.details?.["attemptStatus"]);
654
976
  const network = requirement.network;
655
977
  if (!finished && network === void 0) return error;
656
978
  return new CommerceError("PAYMENT_REPLAYED", error.message, {
@@ -666,9 +988,15 @@ function replayError(error, requirement) {
666
988
  }
667
989
 
668
990
  // src/core/execution/pipeline/admission.ts
669
- function createPaymentAdmission(ctx, authorizeAndReserve) {
991
+ function createPaymentAdmission(ctx, authorizeAndReserve, retryGate) {
670
992
  const { options, safeEmit, buildEvent } = ctx;
671
- return async function admitPayment(flow, request, resource, pricing, validInput) {
993
+ return async function admitPayment(flow, request, resource, pricing, validInput, pipelineStart) {
994
+ const support = assertRetrySupport(
995
+ resource,
996
+ options.store,
997
+ options.deployment,
998
+ request.requestId
999
+ );
672
1000
  const provider = pickProvider(options.paymentProviders, resource.paymentMethods);
673
1001
  if (!provider) {
674
1002
  throw new CommerceError(
@@ -686,6 +1014,15 @@ function createPaymentAdmission(ctx, authorizeAndReserve) {
686
1014
  resource,
687
1015
  request.requestId
688
1016
  );
1017
+ const retry = await retryGate.open(
1018
+ flow,
1019
+ resource,
1020
+ provider,
1021
+ validInput,
1022
+ support,
1023
+ pipelineStart
1024
+ );
1025
+ if (retry?.kind === "delivered") return retry;
689
1026
  let requirement;
690
1027
  try {
691
1028
  requirement = await provider.createRequirement({
@@ -760,6 +1097,7 @@ function createPaymentAdmission(ctx, authorizeAndReserve) {
760
1097
  throw mapped;
761
1098
  }
762
1099
  if (verification.status !== "verified") {
1100
+ const refusal = await refusalFor(verification, requirement, request, resource);
763
1101
  await safeEmit(
764
1102
  buildEvent(flow, {
765
1103
  type: "payment.rejected",
@@ -767,18 +1105,10 @@ function createPaymentAdmission(ctx, authorizeAndReserve) {
767
1105
  adapter: request.protocol,
768
1106
  paymentProvider: provider.name,
769
1107
  status: "error",
770
- data: verification.rejectionReason ? { reason: verification.rejectionReason } : {}
1108
+ data: refusal.code !== "PAYMENT_INVALID" ? { reason: refusal.code } : verification.rejectionReason ? { reason: verification.rejectionReason } : {}
771
1109
  })
772
1110
  );
773
- throw new CommerceError(
774
- "PAYMENT_INVALID",
775
- verification.rejectionReason ?? "Payment was rejected",
776
- {
777
- requestId: request.requestId,
778
- resourceId: resource.id,
779
- ...retryChallenge(requirement, verification.rejectionReason)
780
- }
781
- );
1111
+ throw refusal;
782
1112
  }
783
1113
  if (!verification.replayKey) {
784
1114
  await safeEmit(
@@ -797,78 +1127,136 @@ function createPaymentAdmission(ctx, authorizeAndReserve) {
797
1127
  });
798
1128
  }
799
1129
  const replayKey = verification.replayKey;
800
- const hold = await authorizeAndReserve(
801
- flow,
802
- request,
803
- resource,
804
- authProviders,
805
- requirement,
806
- validInput
807
- );
1130
+ const digest = retry?.fingerprint ?? inputDigest(validInput);
1131
+ if (retry !== void 0) {
1132
+ const stored = await retryGate.claim(
1133
+ flow,
1134
+ resource,
1135
+ provider,
1136
+ retry,
1137
+ verification,
1138
+ pipelineStart
1139
+ );
1140
+ if (stored !== void 0) return stored;
1141
+ }
808
1142
  try {
809
- const attempt = await options.store.reservePaymentAttempt({
810
- requestId: request.requestId,
811
- resourceId: resource.id,
812
- provider: provider.name,
813
- replayKey,
814
- amount: verification.amount,
815
- currency: verification.currency,
816
- ...verification.payer !== void 0 ? { payer: verification.payer } : {},
817
- ...verification.payee !== void 0 ? { payee: verification.payee } : {},
818
- ...requirement.metadata?.[REUSE_REJECTED_AUTHORIZATION_METADATA_KEY] === true ? { reclaimRejected: true } : {},
819
- transaction: newTransaction(
820
- flow,
821
- resource,
822
- requirement,
823
- verification,
824
- validInput,
825
- hold !== void 0 ? { ...hold.record, reservationId: hold.reservationId } : void 0
826
- )
827
- });
828
- flow.journaled = attempt.transactionId === flow.transactionId && options.store.recordTransactionStep !== void 0;
829
- } catch (error) {
830
- const mapped = toCommerceError(
831
- error,
832
- "STORAGE_ERROR",
833
- "Payment attempt could not be recorded"
1143
+ const hold = await authorizeAndReserve(
1144
+ flow,
1145
+ request,
1146
+ resource,
1147
+ authProviders,
1148
+ requirement,
1149
+ validInput
834
1150
  );
835
- await hold?.finalize("release");
1151
+ try {
1152
+ const attempt = await options.store.reservePaymentAttempt({
1153
+ requestId: request.requestId,
1154
+ resourceId: resource.id,
1155
+ provider: provider.name,
1156
+ replayKey,
1157
+ amount: verification.amount,
1158
+ currency: verification.currency,
1159
+ ...verification.payer !== void 0 ? { payer: verification.payer } : {},
1160
+ ...verification.payee !== void 0 ? { payee: verification.payee } : {},
1161
+ ...requirement.metadata?.[REUSE_REJECTED_AUTHORIZATION_METADATA_KEY] === true ? { reclaimRejected: true } : {},
1162
+ transaction: newTransaction(
1163
+ flow,
1164
+ resource,
1165
+ requirement,
1166
+ verification,
1167
+ digest,
1168
+ hold !== void 0 ? { ...hold.record, reservationId: hold.reservationId } : void 0
1169
+ )
1170
+ });
1171
+ flow.journaled = attempt.transactionId === flow.transactionId && options.store.recordTransactionStep !== void 0;
1172
+ } catch (error) {
1173
+ const mapped = toCommerceError(
1174
+ error,
1175
+ "STORAGE_ERROR",
1176
+ "Payment attempt could not be recorded"
1177
+ );
1178
+ await hold?.finalize("release");
1179
+ await safeEmit(
1180
+ buildEvent(flow, {
1181
+ type: "payment.rejected",
1182
+ resourceId: resource.id,
1183
+ adapter: request.protocol,
1184
+ paymentProvider: provider.name,
1185
+ status: "error",
1186
+ data: { reason: mapped.code }
1187
+ })
1188
+ );
1189
+ throw replayError(mapped, requirement);
1190
+ }
836
1191
  await safeEmit(
837
1192
  buildEvent(flow, {
838
- type: "payment.rejected",
1193
+ type: "payment.verified",
839
1194
  resourceId: resource.id,
840
1195
  adapter: request.protocol,
841
1196
  paymentProvider: provider.name,
842
- status: "error",
843
- data: { reason: mapped.code }
1197
+ status: "ok"
844
1198
  })
845
1199
  );
846
- throw replayError(mapped, requirement);
847
- }
848
- await safeEmit(
849
- buildEvent(flow, {
850
- type: "payment.verified",
1200
+ const merchantKey = support !== void 0 && resource.idempotency?.merchantKey === true ? paidOperationKey({
1201
+ deployment: support.deployment,
851
1202
  resourceId: resource.id,
852
- adapter: request.protocol,
853
- paymentProvider: provider.name,
854
- status: "ok"
855
- })
856
- );
857
- return {
858
- kind: "admitted",
859
- settleArgs: {
860
- flow,
861
- request,
862
- resource,
863
- provider,
864
- requirement,
865
- payment,
866
- verification,
867
1203
  replayKey,
868
- hold
869
- }
870
- };
1204
+ inputDigest: digest,
1205
+ ...retry !== void 0 ? { clientKey: retry.clientKey } : {},
1206
+ ...verification.payer !== void 0 ? { payer: verification.payer } : {}
1207
+ }) : void 0;
1208
+ return {
1209
+ kind: "admitted",
1210
+ settleArgs: {
1211
+ flow,
1212
+ request,
1213
+ resource,
1214
+ provider,
1215
+ requirement,
1216
+ payment,
1217
+ verification,
1218
+ replayKey,
1219
+ hold,
1220
+ ...merchantKey !== void 0 ? { merchantKey } : {},
1221
+ ...retry !== void 0 ? { retry } : {}
1222
+ }
1223
+ };
1224
+ } catch (error) {
1225
+ if (retry !== void 0) await retryGate.finishFailed(flow, retry);
1226
+ throw error;
1227
+ }
871
1228
  };
1229
+ async function refusalFor(verification, requirement, request, resource) {
1230
+ const ids = { requestId: request.requestId, resourceId: resource.id };
1231
+ if (verification.replayKey !== void 0) {
1232
+ let attempt;
1233
+ try {
1234
+ attempt = await options.store.findPaymentAttemptByReplayKey?.(verification.replayKey);
1235
+ } catch (error) {
1236
+ return new CommerceError("STORAGE_ERROR", "Payment attempt could not be read", {
1237
+ ...ids,
1238
+ cause: error
1239
+ });
1240
+ }
1241
+ if (attempt !== void 0 && !isFinishedAttempt(attempt.status)) {
1242
+ return replayError(
1243
+ new CommerceError("PAYMENT_REPLAYED", "Payment authorization has already been used", {
1244
+ ...ids,
1245
+ details: { attemptStatus: attempt.status }
1246
+ }),
1247
+ requirement
1248
+ );
1249
+ }
1250
+ }
1251
+ return new CommerceError(
1252
+ "PAYMENT_INVALID",
1253
+ verification.rejectionReason ?? "Payment was rejected",
1254
+ {
1255
+ ...ids,
1256
+ ...retryChallenge(requirement, verification.rejectionReason)
1257
+ }
1258
+ );
1259
+ }
872
1260
  }
873
1261
  function pickProvider(providers, methods) {
874
1262
  for (const method of methods) {
@@ -962,6 +1350,7 @@ function createSettlement(ctx) {
962
1350
  hold
963
1351
  } = args;
964
1352
  await recordStep(flow, { kind: "settling" });
1353
+ flow.chargeRisk = true;
965
1354
  let settlement;
966
1355
  try {
967
1356
  settlement = await provider.settle({
@@ -974,6 +1363,7 @@ function createSettlement(ctx) {
974
1363
  } catch (error) {
975
1364
  const notSubmitted = notSubmittedReason(error);
976
1365
  if (notSubmitted !== void 0) {
1366
+ flow.chargeRisk = false;
977
1367
  await finalizeHold(flow, hold, "release");
978
1368
  await safePersist(
979
1369
  flow,
@@ -1044,6 +1434,7 @@ function createSettlement(ctx) {
1044
1434
  });
1045
1435
  }
1046
1436
  if (settlement.status !== "settled") {
1437
+ flow.chargeRisk = false;
1047
1438
  await finalizeHold(flow, hold, "release");
1048
1439
  await safePersist(
1049
1440
  flow,
@@ -1165,7 +1556,8 @@ function createExecutionPipeline(options) {
1165
1556
  const ctx = createPipelineContext(options);
1166
1557
  const { safeEmit, safePersist, recordStep, buildEvent } = ctx;
1167
1558
  const { settle, abandonSettlement } = createSettlement(ctx);
1168
- const admitPayment = createPaymentAdmission(ctx, createAuthorizeAndReserve(ctx));
1559
+ const retryGate = createRetryGate(ctx);
1560
+ const admitPayment = createPaymentAdmission(ctx, createAuthorizeAndReserve(ctx), retryGate);
1169
1561
  async function execute(request) {
1170
1562
  const pipelineStart = options.clock.monotonicMs();
1171
1563
  const resource = options.resources.get(request.resourceId);
@@ -1229,12 +1621,22 @@ function createExecutionPipeline(options) {
1229
1621
  }
1230
1622
  let settleArgs;
1231
1623
  if (resource.pricing.type === "fixed") {
1232
- const admission = await admitPayment(flow, request, resource, resource.pricing, validInput);
1233
- if (admission.kind === "payment-required") return admission;
1624
+ const admission = await admitPayment(
1625
+ flow,
1626
+ request,
1627
+ resource,
1628
+ resource.pricing,
1629
+ validInput,
1630
+ pipelineStart
1631
+ );
1632
+ if (admission.kind !== "admitted") return admission;
1234
1633
  settleArgs = admission.settleArgs;
1235
1634
  }
1236
1635
  try {
1237
1636
  return await settleAndDeliver(flow, resource, validInput, settleArgs, pipelineStart);
1637
+ } catch (error) {
1638
+ if (settleArgs?.retry !== void 0) await retryGate.finishFailed(flow, settleArgs.retry);
1639
+ throw error;
1238
1640
  } finally {
1239
1641
  await recordStep(flow, { kind: "completed", ...failuresOf(flow) });
1240
1642
  }
@@ -1256,13 +1658,14 @@ function createExecutionPipeline(options) {
1256
1658
  deadlineAt: backendDeadline(options.clock.now(), resource)
1257
1659
  });
1258
1660
  const backendStart = options.clock.monotonicMs();
1661
+ const idempotencyKey = request.idempotencyKey ?? settleArgs?.merchantKey;
1259
1662
  let backendResponse;
1260
1663
  try {
1261
1664
  backendResponse = await options.backend.call(resource.handler, {
1262
1665
  requestId: request.requestId,
1263
1666
  resourceId: resource.id,
1264
1667
  input: validInput,
1265
- ...request.idempotencyKey !== void 0 ? { idempotencyKey: request.idempotencyKey } : {},
1668
+ ...idempotencyKey !== void 0 ? { idempotencyKey } : {},
1266
1669
  ...request.backendHeaders !== void 0 ? { backendHeaders: request.backendHeaders } : {}
1267
1670
  });
1268
1671
  } catch (error) {
@@ -1355,6 +1758,15 @@ function createExecutionPipeline(options) {
1355
1758
  transactionId: flow.transactionId
1356
1759
  };
1357
1760
  await saveReceipt(flow, receipt, "saveReceipt");
1761
+ if (settleArgs?.retry !== void 0) {
1762
+ await retryGate.finishDelivered(
1763
+ flow,
1764
+ settleArgs.retry,
1765
+ settleArgs.verification,
1766
+ backendResponse,
1767
+ receipt
1768
+ );
1769
+ }
1358
1770
  const totalDurationMs = Math.round(options.clock.monotonicMs() - pipelineStart);
1359
1771
  const failures = failuresOf(flow);
1360
1772
  await safeEmit(
@@ -1456,47 +1868,6 @@ function createStoreEventSink(options) {
1456
1868
  };
1457
1869
  }
1458
1870
 
1459
- // src/protocols/acp/constants.ts
1460
- var ACP_SPEC_VERSION = "2026-04-17";
1461
- var ACP_API_VERSION = "2026-04-17";
1462
- var ACP_WELL_KNOWN_PATH = "/.well-known/acp.json";
1463
- var ACP_CHECKOUT_OPERATIONS = [
1464
- "createCheckoutSession",
1465
- "updateCheckoutSession",
1466
- "getCheckoutSession",
1467
- "completeCheckoutSession",
1468
- "cancelCheckoutSession"
1469
- ];
1470
- var ACP_OPERATION_INPUT_KEYS = {
1471
- createCheckoutSession: ["body"],
1472
- updateCheckoutSession: ["path", "body"],
1473
- getCheckoutSession: ["path"],
1474
- completeCheckoutSession: ["path", "body"],
1475
- cancelCheckoutSession: ["path"]
1476
- };
1477
- var ACP_OPERATION_OPTIONAL_INPUT_KEYS = {
1478
- cancelCheckoutSession: ["body"]
1479
- };
1480
- var ACP_SESSION_ID_INPUT_KEY = "checkout_session_id";
1481
- var ACP_JSON_MEDIA_TYPE = "application/json";
1482
- var ACP_API_VERSION_HEADER = "api-version";
1483
- var ACP_REQUEST_ID_HEADER = "request-id";
1484
- var ACP_IDEMPOTENCY_KEY_HEADER = "idempotency-key";
1485
- var ACP_IDEMPOTENT_REPLAYED_HEADER = "idempotent-replayed";
1486
- var ACP_IN_FLIGHT_RETRY_AFTER_SECONDS = 1;
1487
- var ACP_MAX_REQUEST_ID_LENGTH = 128;
1488
- var ACP_FORWARDED_HEADERS = [
1489
- "accept-language",
1490
- "user-agent",
1491
- ACP_REQUEST_ID_HEADER,
1492
- ACP_API_VERSION_HEADER,
1493
- "signature",
1494
- "timestamp"
1495
- ];
1496
- var ACP_MAX_FORWARDED_HEADER_LENGTH = 2048;
1497
- var ACP_MERCHANT_RETRY_AFTER_DEFAULT_SECONDS = 5;
1498
- var ACP_MERCHANT_RETRY_AFTER_MAX_SECONDS = 300;
1499
-
1500
- export { ACP_API_VERSION, ACP_API_VERSION_HEADER, ACP_CHECKOUT_OPERATIONS, ACP_FORWARDED_HEADERS, ACP_IDEMPOTENCY_KEY_HEADER, ACP_IDEMPOTENT_REPLAYED_HEADER, ACP_IN_FLIGHT_RETRY_AFTER_SECONDS, ACP_JSON_MEDIA_TYPE, ACP_MAX_FORWARDED_HEADER_LENGTH, ACP_MAX_REQUEST_ID_LENGTH, ACP_MERCHANT_RETRY_AFTER_DEFAULT_SECONDS, ACP_MERCHANT_RETRY_AFTER_MAX_SECONDS, ACP_OPERATION_INPUT_KEYS, ACP_OPERATION_OPTIONAL_INPUT_KEYS, ACP_REQUEST_ID_HEADER, ACP_SESSION_ID_INPUT_KEY, ACP_SPEC_VERSION, ACP_WELL_KNOWN_PATH, BackendErrorResponse, DEFAULT_CONFIG_FILENAME, HttpBackendExecutor, createExecutionPipeline, createResourceRegistry, createStoreEventSink, extractPathParameterNames, findUnparsedBraceToken, isObjectSchemaNode };
1501
- //# sourceMappingURL=chunk-Z34UMZBB.js.map
1502
- //# sourceMappingURL=chunk-Z34UMZBB.js.map
1871
+ export { ACP_API_VERSION, ACP_API_VERSION_HEADER, ACP_CHECKOUT_OPERATIONS, ACP_FORWARDED_HEADERS, ACP_IDEMPOTENCY_KEY_HEADER, ACP_IDEMPOTENT_REPLAYED_HEADER, ACP_IN_FLIGHT_RETRY_AFTER_SECONDS, ACP_JSON_MEDIA_TYPE, ACP_MAX_FORWARDED_HEADER_LENGTH, ACP_MAX_REQUEST_ID_LENGTH, ACP_MERCHANT_RETRY_AFTER_DEFAULT_SECONDS, ACP_MERCHANT_RETRY_AFTER_MAX_SECONDS, ACP_OPERATION_INPUT_KEYS, ACP_OPERATION_OPTIONAL_INPUT_KEYS, ACP_REQUEST_ID_HEADER, ACP_SESSION_ID_INPUT_KEY, ACP_SPEC_VERSION, ACP_WELL_KNOWN_PATH, BackendErrorResponse, DEFAULT_CONFIG_FILENAME, HttpBackendExecutor, MAX_REDELIVERY_RETENTION_HOURS, assertRetrySupport, createExecutionPipeline, createResourceRegistry, createStoreEventSink, extractPathParameterNames, findUnparsedBraceToken, isObjectSchemaNode };
1872
+ //# sourceMappingURL=chunk-OETKXDGA.js.map
1873
+ //# sourceMappingURL=chunk-OETKXDGA.js.map