@visa/cli 4.1.0-rc.11 → 4.1.0-rc.13

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 (58) hide show
  1. package/dist/checkout-engine/adapters/generic.d.ts +19 -0
  2. package/dist/checkout-engine/adapters/generic.js +201 -0
  3. package/dist/checkout-engine/adapters/index.d.ts +7 -0
  4. package/dist/checkout-engine/adapters/index.js +17 -0
  5. package/dist/checkout-engine/adapters/stripe-like.d.ts +10 -0
  6. package/dist/checkout-engine/adapters/stripe-like.js +21 -0
  7. package/dist/checkout-engine/browser-launch.d.ts +46 -0
  8. package/dist/checkout-engine/browser-launch.js +81 -0
  9. package/dist/checkout-engine/ceremony.d.ts +64 -0
  10. package/dist/checkout-engine/ceremony.js +261 -0
  11. package/dist/checkout-engine/cli-engine.d.ts +60 -0
  12. package/dist/checkout-engine/cli-engine.js +225 -0
  13. package/dist/checkout-engine/detect.d.ts +61 -0
  14. package/dist/checkout-engine/detect.js +372 -0
  15. package/dist/checkout-engine/evidence.d.ts +22 -0
  16. package/dist/checkout-engine/evidence.js +59 -0
  17. package/dist/checkout-engine/executor.d.ts +147 -0
  18. package/dist/checkout-engine/executor.js +1187 -0
  19. package/dist/checkout-engine/hosted-approval.d.ts +69 -0
  20. package/dist/checkout-engine/hosted-approval.js +159 -0
  21. package/dist/checkout-engine/index.d.ts +3 -0
  22. package/dist/checkout-engine/index.js +5 -0
  23. package/dist/checkout-engine/inline-target.d.ts +13 -0
  24. package/dist/checkout-engine/inline-target.js +37 -0
  25. package/dist/checkout-engine/instrument.d.ts +54 -0
  26. package/dist/checkout-engine/instrument.js +83 -0
  27. package/dist/checkout-engine/live-fill-approval.d.ts +52 -0
  28. package/dist/checkout-engine/live-fill-approval.js +107 -0
  29. package/dist/checkout-engine/mandate.d.ts +25 -0
  30. package/dist/checkout-engine/mandate.js +100 -0
  31. package/dist/checkout-engine/outcome.d.ts +30 -0
  32. package/dist/checkout-engine/outcome.js +190 -0
  33. package/dist/checkout-engine/owner-only-file.d.ts +10 -0
  34. package/dist/checkout-engine/owner-only-file.js +22 -0
  35. package/dist/checkout-engine/package.json +3 -0
  36. package/dist/checkout-engine/pay-args.d.ts +14 -0
  37. package/dist/checkout-engine/pay-args.js +44 -0
  38. package/dist/checkout-engine/pay.d.ts +1 -0
  39. package/dist/checkout-engine/pay.js +13 -0
  40. package/dist/checkout-engine/receipt.d.ts +81 -0
  41. package/dist/checkout-engine/receipt.js +109 -0
  42. package/dist/checkout-engine/repo-env.d.ts +11 -0
  43. package/dist/checkout-engine/repo-env.js +23 -0
  44. package/dist/checkout-engine/run-live-fill.d.ts +1 -0
  45. package/dist/checkout-engine/run-live-fill.js +443 -0
  46. package/dist/checkout-engine/types.d.ts +26 -0
  47. package/dist/checkout-engine/types.js +2 -0
  48. package/dist/checkout-engine/vgs-gateway/fetch-credential.d.mts +74 -0
  49. package/dist/checkout-engine/vgs-gateway/fetch-credential.mjs +240 -0
  50. package/dist/checkout-engine/vgs-live-instrument.d.ts +141 -0
  51. package/dist/checkout-engine/vgs-live-instrument.js +252 -0
  52. package/dist/checkout-engine/vic-confirmation.d.ts +34 -0
  53. package/dist/checkout-engine/vic-confirmation.js +39 -0
  54. package/dist/cli.js +255 -255
  55. package/dist/mcp-server/index.js +121 -121
  56. package/native/bin/win32-x64/visa-keychain-win.exe +0 -0
  57. package/package.json +4 -3
  58. package/server.json +2 -2
@@ -0,0 +1,39 @@
1
+ /** Definitive merchant answers map to a status; everything else maps to none. */
2
+ export function outcomeToTransactionStatus(outcome) {
3
+ if (outcome === 'confirmed')
4
+ return 'APPROVED';
5
+ if (outcome === 'declined')
6
+ return 'DECLINED';
7
+ return null;
8
+ }
9
+ export async function reportVicOutcome(input) {
10
+ const transactionStatus = outcomeToTransactionStatus(input.outcome);
11
+ if (!transactionStatus) {
12
+ return {
13
+ posted: false,
14
+ reason: `outcome '${input.outcome}' is not a definitive merchant answer — ` +
15
+ 'resolve it with the merchant, then post the confirmation manually',
16
+ };
17
+ }
18
+ if (!input.target) {
19
+ return { posted: false, reason: 'no VIC credential was minted in this run' };
20
+ }
21
+ try {
22
+ await input.post({
23
+ tokenId: input.target.tokenId,
24
+ intentId: input.target.intentId,
25
+ transactionStatus,
26
+ transactionType: 'PURCHASE',
27
+ transactionTimestamp: (input.timestamp ?? new Date()).toISOString(),
28
+ transaction: input.transaction,
29
+ });
30
+ return { posted: true, transactionStatus };
31
+ }
32
+ catch (err) {
33
+ return {
34
+ posted: false,
35
+ reason: `confirmation POST failed: ${err.message} — the merchant outcome stands; ` +
36
+ 'retry the confirmation for this intent out-of-band',
37
+ };
38
+ }
39
+ }