@visa/cli 4.1.0-rc.120 → 4.1.0-rc.121

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.
@@ -1,21 +1,10 @@
1
1
  import type { CheckoutMode, CheckoutOutcome, CheckoutResult } from './executor.js';
2
- export declare const SUBMIT_ENV_FLAG = "CHECKOUT_AGENT_ALLOW_SUBMIT";
3
2
  export declare const MODE_ENV_FLAG = "CHECKOUT_AGENT_MODE";
4
3
  /**
5
4
  * `--mode` values map 1:1 onto CheckoutMode; an absent flag falls back to the
6
5
  * CHECKOUT_AGENT_MODE environment default, then to the safe dry-run default.
7
6
  */
8
7
  export declare function parseCheckoutMode(value: string | undefined, env?: Record<string, string | undefined>): CheckoutMode;
9
- /**
10
- * Fail fast (before any file read or browser launch) when submit lacks an
11
- * enablement. The env arm exists to stop AUTOMATION from reaching a live
12
- * charge by accident — so it is required only when stdin is not a real TTY
13
- * (scripts, agents, pipes). An interactive human needs no standing config:
14
- * their per-run consent is the typed PAY phrase plus the passkey tap, both of
15
- * which a non-interactive caller cannot fake (the phrase names the exact
16
- * review id; the passkey is a FIDO ceremony on the verify site).
17
- */
18
- export declare function assertSubmitAllowed(mode: CheckoutMode, env?: Record<string, string | undefined>, isInteractive?: boolean): void;
19
8
  /** Distinct phrases per mode so dry-run muscle memory can never authorize a payment. */
20
9
  export declare function approvalPhrase(mode: CheckoutMode, reviewId: string): string;
21
10
  /** Integer-only minor→display formatting (two-decimal currencies, the same assumption as decimalToMinor). */
@@ -1,18 +1,19 @@
1
1
  // Deliberate-enablement seam for run-live-fill's submit mode. A real submit
2
2
  // moves real money, so it requires:
3
- // 1. an interactive human at a real TTY — or, for scripted/agent runs,
4
- // the explicit CHECKOUT_AGENT_ALLOW_SUBMIT=1 environment arm,
5
- // 2. the invocation opts in (--mode submit, or the CHECKOUT_AGENT_MODE
3
+ // 1. the invocation opts in (--mode submit, or the CHECKOUT_AGENT_MODE
6
4
  // environment default for operators who always run one mode),
7
- // 3. the operator types the PAY phrase against the exact review id (and a
5
+ // 2. the operator types the PAY phrase against the exact review id (and a
8
6
  // hosted run additionally requires the passkey tap on the verify site).
9
- // The env arm is an anti-automation gate, not a human ritual: a TTY human's
10
- // consent is act 3 the PAY phrase differs from dry-run's FILL phrase, so a
11
- // muscle-memory rerun of the dry-run procedure still cannot drift into
12
- // charging a card — while a non-interactive caller (script, agent, pipe) can
13
- // fake neither the phrase's review id nor the FIDO ceremony and must also be
14
- // explicitly armed. Fresh checkouts therefore need ZERO persisted config.
15
- export const SUBMIT_ENV_FLAG = 'CHECKOUT_AGENT_ALLOW_SUBMIT';
7
+ // The PAY phrase differs from dry-run's FILL phrase and names the exact review
8
+ // id, so a muscle-memory rerun of the dry-run procedure cannot drift into
9
+ // charging a card. Fresh checkouts need ZERO persisted config.
10
+ //
11
+ // There was a third requirement a CHECKOUT_AGENT_ALLOW_SUBMIT=1 environment
12
+ // arm, exempted for interactive TTYs meant to stop AUTOMATION reaching a live
13
+ // charge. It never ran: nothing in the product ever called `assertSubmitAllowed`.
14
+ // The same flag DID gate `pay_merchant`, where being default-off with no
15
+ // in-product way to set it meant a real install could not complete a purchase at
16
+ // all. Both are gone; the phrase and the mandate caps are the gates.
16
17
  export const MODE_ENV_FLAG = 'CHECKOUT_AGENT_MODE';
17
18
  /**
18
19
  * `--mode` values map 1:1 onto CheckoutMode; an absent flag falls back to the
@@ -26,26 +27,6 @@ export function parseCheckoutMode(value, env = process.env) {
26
27
  return 'submit';
27
28
  throw new Error(`--mode (or ${MODE_ENV_FLAG}) must be dry-run or submit (got ${JSON.stringify(effective)})`);
28
29
  }
29
- /**
30
- * Fail fast (before any file read or browser launch) when submit lacks an
31
- * enablement. The env arm exists to stop AUTOMATION from reaching a live
32
- * charge by accident — so it is required only when stdin is not a real TTY
33
- * (scripts, agents, pipes). An interactive human needs no standing config:
34
- * their per-run consent is the typed PAY phrase plus the passkey tap, both of
35
- * which a non-interactive caller cannot fake (the phrase names the exact
36
- * review id; the passkey is a FIDO ceremony on the verify site).
37
- */
38
- export function assertSubmitAllowed(mode, env = process.env, isInteractive = process.stdin.isTTY === true) {
39
- if (mode !== 'submit')
40
- return;
41
- if (env[SUBMIT_ENV_FLAG] === '1')
42
- return;
43
- if (isInteractive)
44
- return;
45
- throw new Error(`--mode submit refused: this is not an interactive terminal, and scripted submits ` +
46
- `require ${SUBMIT_ENV_FLAG}=1. The gate is default-off so automation cannot ` +
47
- 'reach a live charge by accident.');
48
- }
49
30
  /** Distinct phrases per mode so dry-run muscle memory can never authorize a payment. */
50
31
  export function approvalPhrase(mode, reviewId) {
51
32
  return `${mode === 'submit' ? 'PAY' : 'CHECK'} ${reviewId}`;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Load the monorepo root `.env` as DEFAULTS for the runner, so stable
3
3
  * per-machine config (VGS credentials, CHECKOUT_APPROVAL_BASE_URL,
4
- * CHECKOUT_AGENT_ALLOW_SUBMIT, CHECKOUT_AGENT_MODE) is set once instead of
4
+ * CHECKOUT_AGENT_MODE) is set once instead of
5
5
  * retyped on every invocation. `process.loadEnvFile` never overrides
6
6
  * variables already present in the environment (verified: shell always wins),
7
7
  * so an explicit `FOO=x pnpm pay …` still beats the file. A missing file is
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url';
2
2
  /**
3
3
  * Load the monorepo root `.env` as DEFAULTS for the runner, so stable
4
4
  * per-machine config (VGS credentials, CHECKOUT_APPROVAL_BASE_URL,
5
- * CHECKOUT_AGENT_ALLOW_SUBMIT, CHECKOUT_AGENT_MODE) is set once instead of
5
+ * CHECKOUT_AGENT_MODE) is set once instead of
6
6
  * retyped on every invocation. `process.loadEnvFile` never overrides
7
7
  * variables already present in the environment (verified: shell always wins),
8
8
  * so an explicit `FOO=x pnpm pay …` still beats the file. A missing file is