@vonpay/checkout-cli 0.1.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.
- package/README.md +60 -0
- package/dist/commands/checkout.d.ts +3 -0
- package/dist/commands/checkout.d.ts.map +1 -0
- package/dist/commands/checkout.js +16 -0
- package/dist/commands/checkout.js.map +1 -0
- package/dist/commands/health.d.ts +3 -0
- package/dist/commands/health.d.ts.map +1 -0
- package/dist/commands/health.js +45 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +60 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +43 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/sessions.d.ts +3 -0
- package/dist/commands/sessions.d.ts.map +1 -0
- package/dist/commands/sessions.js +126 -0
- package/dist/commands/sessions.js.map +1 -0
- package/dist/commands/trigger.d.ts +3 -0
- package/dist/commands/trigger.d.ts.map +1 -0
- package/dist/commands/trigger.js +89 -0
- package/dist/commands/trigger.js.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +42 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @vonpay/checkout-cli
|
|
2
|
+
|
|
3
|
+
Command-line tools for developers integrating with [Von Payments Checkout](https://docs.vonpay.com). Create test sessions, inspect session state, trigger webhook events, and bootstrap local integration work.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @vonpay/checkout-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Requires:** Node 20+.
|
|
12
|
+
|
|
13
|
+
## Login
|
|
14
|
+
|
|
15
|
+
Save your Von Payments API key once:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
vonpay checkout login
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Stores credentials at `~/.vonpay/config.json`. Use a test-mode key (`vp_sk_test_...`) for local development.
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
All commands are namespaced under `vonpay checkout`:
|
|
26
|
+
|
|
27
|
+
| Command | Purpose |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `vonpay checkout login` | Save API key to `~/.vonpay/config.json` |
|
|
30
|
+
| `vonpay checkout init` | Scaffold a minimal checkout integration starter |
|
|
31
|
+
| `vonpay checkout sessions list` | List recent checkout sessions |
|
|
32
|
+
| `vonpay checkout sessions create` | Create a test checkout session and print the URL |
|
|
33
|
+
| `vonpay checkout sessions get <id>` | Fetch session details |
|
|
34
|
+
| `vonpay checkout trigger <event>` | Trigger a synthetic webhook event against your local endpoint |
|
|
35
|
+
| `vonpay checkout health` | Check Von Payments API health and latency |
|
|
36
|
+
|
|
37
|
+
Run `vonpay checkout --help` for the full flag reference.
|
|
38
|
+
|
|
39
|
+
## Quick start
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# One-time setup
|
|
43
|
+
vonpay checkout login
|
|
44
|
+
|
|
45
|
+
# Create a test session
|
|
46
|
+
vonpay checkout sessions create --amount 1499 --currency USD --country US
|
|
47
|
+
|
|
48
|
+
# Trigger a payment.succeeded webhook against localhost:3000
|
|
49
|
+
vonpay checkout trigger payment.succeeded --url http://localhost:3000/webhooks/vonpay
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Documentation
|
|
53
|
+
|
|
54
|
+
- [CLI reference](https://docs.vonpay.com/sdks/cli)
|
|
55
|
+
- [API reference](https://docs.vonpay.com/reference/api)
|
|
56
|
+
- [Quickstart](https://docs.vonpay.com/quickstart)
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/commands/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAUvD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { loginCommand } from "./login.js";
|
|
2
|
+
import { initCommand } from "./init.js";
|
|
3
|
+
import { sessionsCommand } from "./sessions.js";
|
|
4
|
+
import { triggerCommand } from "./trigger.js";
|
|
5
|
+
import { healthCommand } from "./health.js";
|
|
6
|
+
export function registerCheckout(program) {
|
|
7
|
+
const checkout = program
|
|
8
|
+
.command("checkout")
|
|
9
|
+
.description("Checkout integration tools");
|
|
10
|
+
checkout.addCommand(loginCommand());
|
|
11
|
+
checkout.addCommand(initCommand());
|
|
12
|
+
checkout.addCommand(sessionsCommand());
|
|
13
|
+
checkout.addCommand(triggerCommand());
|
|
14
|
+
checkout.addCommand(healthCommand());
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=checkout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../src/commands/checkout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,MAAM,QAAQ,GAAG,OAAO;SACrB,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,4BAA4B,CAAC,CAAC;IAE7C,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC;IACpC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IACnC,QAAQ,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;IACvC,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;IACtC,QAAQ,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/commands/health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,aAAa,IAAI,OAAO,CA2CvC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import ora from "ora";
|
|
4
|
+
import { VonPayCheckout, VonPayError } from "@vonpay/checkout-node";
|
|
5
|
+
import { requireApiKey } from "../config.js";
|
|
6
|
+
export function healthCommand() {
|
|
7
|
+
return new Command("health")
|
|
8
|
+
.description("Check checkout API health")
|
|
9
|
+
.option("--json", "Output raw JSON")
|
|
10
|
+
.action(async (opts) => {
|
|
11
|
+
const client = new VonPayCheckout(requireApiKey());
|
|
12
|
+
const spinner = ora("Checking API health...").start();
|
|
13
|
+
try {
|
|
14
|
+
const health = await client.health();
|
|
15
|
+
spinner.stop();
|
|
16
|
+
if (opts.json) {
|
|
17
|
+
console.log(JSON.stringify(health, null, 2));
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const statusColor = health.status === "ok"
|
|
21
|
+
? chalk.green
|
|
22
|
+
: health.status === "degraded"
|
|
23
|
+
? chalk.yellow
|
|
24
|
+
: chalk.red;
|
|
25
|
+
console.log(` Status: ${statusColor(health.status)}`);
|
|
26
|
+
console.log(` Latency: ${health.latencyMs}ms`);
|
|
27
|
+
if (health.version) {
|
|
28
|
+
console.log(` Version: ${health.version}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
spinner.stop();
|
|
34
|
+
if (err instanceof VonPayError) {
|
|
35
|
+
console.error(chalk.red(`API error: ${err.message}`));
|
|
36
|
+
console.error(chalk.dim(` Code: ${err.code}`));
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
console.error(chalk.red(`Cannot reach API: ${err instanceof Error ? err.message : err}`));
|
|
40
|
+
}
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../src/commands/health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC;SACzB,WAAW,CAAC,2BAA2B,CAAC;SACxC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC;SACnC,MAAM,CAAC,KAAK,EAAE,IAAwB,EAAE,EAAE;QACzC,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,aAAa,EAAE,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,GAAG,CAAC,wBAAwB,CAAC,CAAC,KAAK,EAAE,CAAC;QAEtD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;YACrC,OAAO,CAAC,IAAI,E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ACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,wBAAgB,WAAW,IAAI,OAAO,CAmErC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { appendFileSync, existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import { getApiKey } from "../config.js";
|
|
6
|
+
function ensureGitignoreBlocksEnv() {
|
|
7
|
+
if (!existsSync(".gitignore"))
|
|
8
|
+
return "no-repo";
|
|
9
|
+
const lines = readFileSync(".gitignore", "utf-8").split(/\r?\n/);
|
|
10
|
+
if (lines.some((l) => l.trim() === ".env" || l.trim() === "/.env")) {
|
|
11
|
+
return "already";
|
|
12
|
+
}
|
|
13
|
+
appendFileSync(".gitignore", "\n# Added by vonpay checkout init\n.env\n");
|
|
14
|
+
return "added";
|
|
15
|
+
}
|
|
16
|
+
export function initCommand() {
|
|
17
|
+
return new Command("init")
|
|
18
|
+
.description("Initialize a project with Von Payments checkout")
|
|
19
|
+
.option("-f, --force", "Overwrite existing .env file")
|
|
20
|
+
.action(async (opts) => {
|
|
21
|
+
const apiKey = getApiKey();
|
|
22
|
+
if (!apiKey) {
|
|
23
|
+
console.error(chalk.red("No API key found. Run `vonpay checkout login` first or set VON_PAY_SECRET_KEY."));
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
const envFile = ".env";
|
|
27
|
+
const absPath = resolve(envFile);
|
|
28
|
+
if (existsSync(envFile) && !opts.force) {
|
|
29
|
+
console.error(chalk.yellow(`.env already exists at ${absPath}. Use --force to overwrite.`));
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
const mode = apiKey.includes("_test_") ? "test" : "live";
|
|
33
|
+
if (mode === "live") {
|
|
34
|
+
console.warn(chalk.yellow(`⚠ About to write a LIVE API key to ${absPath}.\n Confirm this is the intended directory, then re-run with --force if you're sure.`));
|
|
35
|
+
if (!opts.force) {
|
|
36
|
+
console.error(chalk.red("Refusing to write live key without --force."));
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const content = [
|
|
41
|
+
"# Von Payments Checkout",
|
|
42
|
+
`# Mode: ${mode}`,
|
|
43
|
+
`VON_PAY_SECRET_KEY=${apiKey}`,
|
|
44
|
+
"",
|
|
45
|
+
].join("\n");
|
|
46
|
+
writeFileSync(envFile, content, { encoding: "utf-8", mode: 0o600 });
|
|
47
|
+
console.log(chalk.green(`✓ .env created (${mode} mode) → ${absPath}`));
|
|
48
|
+
const gitignoreState = ensureGitignoreBlocksEnv();
|
|
49
|
+
if (gitignoreState === "added") {
|
|
50
|
+
console.log(chalk.dim(" Added .env to .gitignore"));
|
|
51
|
+
}
|
|
52
|
+
else if (gitignoreState === "already") {
|
|
53
|
+
console.log(chalk.dim(" .env already listed in .gitignore ✓"));
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
console.log(chalk.yellow(" No .gitignore found. If this is a git repo, add .env to your .gitignore before committing."));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CA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M,CACV,8FAA8F,CAC/F,CACF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiBpC,wBAAgB,YAAY,IAAI,OAAO,CAgDtC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { createInterface } from "node:readline";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { loadConfig, saveConfig } from "../config.js";
|
|
5
|
+
const VALID_PREFIXES = ["vp_sk_test_", "vp_sk_live_"];
|
|
6
|
+
function readLine(prompt) {
|
|
7
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
8
|
+
return new Promise((resolve) => {
|
|
9
|
+
rl.question(prompt, (answer) => {
|
|
10
|
+
rl.close();
|
|
11
|
+
resolve(answer.trim());
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export function loginCommand() {
|
|
16
|
+
return new Command("login")
|
|
17
|
+
.description("Store your API key for CLI access")
|
|
18
|
+
.argument("[key]", "API secret key (vp_sk_*)")
|
|
19
|
+
.action(async (key) => {
|
|
20
|
+
let apiKey = key;
|
|
21
|
+
if (!apiKey) {
|
|
22
|
+
console.log(chalk.dim("Get your API key from the Von Payments dashboard → Developers"));
|
|
23
|
+
apiKey = await readLine("API key (vp_sk_*): ");
|
|
24
|
+
}
|
|
25
|
+
if (!apiKey) {
|
|
26
|
+
console.error(chalk.red("No key provided."));
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
if (!VALID_PREFIXES.some((p) => apiKey.startsWith(p))) {
|
|
30
|
+
console.error(chalk.red(`Invalid key format. Must start with ${VALID_PREFIXES.join(" or ")}`));
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
const config = loadConfig();
|
|
34
|
+
config.checkout = { ...config.checkout, apiKey };
|
|
35
|
+
saveConfig(config);
|
|
36
|
+
const mode = apiKey.includes("_test_") ? "test" : "live";
|
|
37
|
+
if (key) {
|
|
38
|
+
console.warn(chalk.yellow("Warning: passing keys as a command argument exposes them in shell history and process-list (`ps`). Use interactive mode (`vonpay checkout login`) instead."));
|
|
39
|
+
}
|
|
40
|
+
console.log(chalk.green(`✓ API key saved (${mode} mode) → ~/.vonpay/config.json`));
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,cAAc,GAAG,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AAEtD,SAAS,QAAQ,CAAC,MAAc;IAC9B,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;YAC7B,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,OAAO,CAAC,OAAO,CAA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;QAED,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CAAC,oBAAoB,IAAI,gCAAgC,CAAC,CACtE,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../src/commands/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,eAAe,IAAI,OAAO,CAoHzC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import ora from "ora";
|
|
4
|
+
import { VonPayCheckout, VonPayError } from "@vonpay/checkout-node";
|
|
5
|
+
import { requireApiKey } from "../config.js";
|
|
6
|
+
function makeClient() {
|
|
7
|
+
return new VonPayCheckout(requireApiKey());
|
|
8
|
+
}
|
|
9
|
+
export function sessionsCommand() {
|
|
10
|
+
const sessions = new Command("sessions").description("Create and manage checkout sessions");
|
|
11
|
+
sessions
|
|
12
|
+
.command("create")
|
|
13
|
+
.description("Create a new checkout session")
|
|
14
|
+
.requiredOption("--amount <cents>", "Amount in minor units (e.g. 1499 = $14.99)", (v) => parseInt(v, 10))
|
|
15
|
+
.requiredOption("--currency <code>", "Currency code (e.g. USD)")
|
|
16
|
+
.option("--country <code>", "Country code (e.g. US)")
|
|
17
|
+
.option("--description <text>", "Session description")
|
|
18
|
+
.option("--success-url <url>", "Redirect URL on success")
|
|
19
|
+
.option("--cancel-url <url>", "Redirect URL on cancel")
|
|
20
|
+
.option("--idempotency-key <key>", "Idempotency key for safe retries")
|
|
21
|
+
.option("--dry-run", "Validate without creating a session")
|
|
22
|
+
.option("--json", "Output raw JSON")
|
|
23
|
+
.action(async (opts) => {
|
|
24
|
+
const client = makeClient();
|
|
25
|
+
const spinner = ora("Creating session...").start();
|
|
26
|
+
try {
|
|
27
|
+
const params = {
|
|
28
|
+
amount: opts.amount,
|
|
29
|
+
currency: opts.currency.toUpperCase(),
|
|
30
|
+
country: opts.country?.toUpperCase(),
|
|
31
|
+
description: opts.description,
|
|
32
|
+
successUrl: opts.successUrl,
|
|
33
|
+
cancelUrl: opts.cancelUrl,
|
|
34
|
+
};
|
|
35
|
+
if (opts.dryRun) {
|
|
36
|
+
spinner.text = "Validating...";
|
|
37
|
+
const result = await client.sessions.validate(params);
|
|
38
|
+
spinner.stop();
|
|
39
|
+
if (opts.json) {
|
|
40
|
+
console.log(JSON.stringify(result, null, 2));
|
|
41
|
+
}
|
|
42
|
+
else if (result.valid) {
|
|
43
|
+
console.log(chalk.green("✓ Valid request"));
|
|
44
|
+
if (result.warnings.length > 0) {
|
|
45
|
+
for (const w of result.warnings) {
|
|
46
|
+
console.log(chalk.yellow(` ⚠ ${w}`));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
console.log(chalk.red("✗ Invalid request"));
|
|
52
|
+
}
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const session = await client.sessions.create(params, opts.idempotencyKey
|
|
56
|
+
? { idempotencyKey: opts.idempotencyKey }
|
|
57
|
+
: undefined);
|
|
58
|
+
spinner.stop();
|
|
59
|
+
if (opts.json) {
|
|
60
|
+
console.log(JSON.stringify(session, null, 2));
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
console.log(chalk.green("✓ Session created"));
|
|
64
|
+
console.log(` ID: ${session.id}`);
|
|
65
|
+
console.log(` URL: ${chalk.cyan(session.checkoutUrl)}`);
|
|
66
|
+
console.log(` Expires: ${session.expiresAt}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
spinner.stop();
|
|
71
|
+
handleError(err);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
sessions
|
|
75
|
+
.command("get")
|
|
76
|
+
.description("Get session status")
|
|
77
|
+
.argument("<id>", "Session ID")
|
|
78
|
+
.option("--json", "Output raw JSON")
|
|
79
|
+
.action(async (id, opts) => {
|
|
80
|
+
const client = makeClient();
|
|
81
|
+
const spinner = ora("Fetching session...").start();
|
|
82
|
+
try {
|
|
83
|
+
const session = await client.sessions.get(id);
|
|
84
|
+
spinner.stop();
|
|
85
|
+
if (opts.json) {
|
|
86
|
+
console.log(JSON.stringify(session, null, 2));
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
const statusColor = session.status === "succeeded"
|
|
90
|
+
? chalk.green
|
|
91
|
+
: session.status === "failed"
|
|
92
|
+
? chalk.red
|
|
93
|
+
: session.status === "expired"
|
|
94
|
+
? chalk.gray
|
|
95
|
+
: chalk.yellow;
|
|
96
|
+
console.log(` ID: ${session.id}`);
|
|
97
|
+
console.log(` Status: ${statusColor(session.status)}`);
|
|
98
|
+
console.log(` Amount: ${(session.amount / 100).toFixed(2)} ${session.currency}`);
|
|
99
|
+
if (session.transactionId) {
|
|
100
|
+
console.log(` Transaction: ${session.transactionId}`);
|
|
101
|
+
}
|
|
102
|
+
console.log(` Created: ${session.createdAt}`);
|
|
103
|
+
console.log(` Expires: ${session.expiresAt}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
spinner.stop();
|
|
108
|
+
handleError(err);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return sessions;
|
|
112
|
+
}
|
|
113
|
+
function handleError(err) {
|
|
114
|
+
if (err instanceof VonPayError) {
|
|
115
|
+
console.error(chalk.red(`Error: ${err.message}`));
|
|
116
|
+
console.error(chalk.dim(` Code: ${err.code}`));
|
|
117
|
+
console.error(chalk.dim(` Fix: ${err.fix}`));
|
|
118
|
+
if (err.requestId) {
|
|
119
|
+
console.error(chalk.dim(` Request ID: ${err.requestId}`));
|
|
120
|
+
}
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
console.error(chalk.red(`Error: ${err instanceof Error ? err.message : err}`));
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=sessions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../src/commands/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,SAAS,UAAU;IACjB,OAAO,IAAI,cAAc,CAAC,aAAa,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,QAAQ,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,WAAW,CAClD,qCAAqC,CACtC,CAAC;IAEF,QAAQ;SACL,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,+BAA+B,CAAC;SAC5C,cAAc,CAAC,kBAAkB,EAAE,4CAA4C,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACxG,cAAc,CAAC,mBAAmB,EAAE,0BAA0B,CAAC;SAC/D,MAAM,CAAC,kBAAkB,EAAE,wBAAwB,CAAC;SACpD,MAAM,CAAC,sBAAsB,EAAE,qBAAqB,CAAC;SACrD,MAAM,CAAC,qBAAqB,EAAE,yBAAyB,CAAC;SACxD,MAAM,CAAC,oBAAoB,EAAE,wBAAwB,CAAC;SACtD,MAAM,CAAC,yBAAyB,EAAE,kCAAkC,CAAC;SACrE,MAAM,CAAC,WAAW,EAAE,qCAAqC,CAAC;SAC1D,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC;SACnC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB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,OAAO,EAAE,MAAM,WAAW,CAAC;AAyCpC,wBAAgB,cAAc,IAAI,OAAO,CA0ExC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { createHmac, randomUUID } from "node:crypto";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import ora from "ora";
|
|
5
|
+
import { requireApiKey } from "../config.js";
|
|
6
|
+
const SUPPORTED_EVENTS = [
|
|
7
|
+
"session.succeeded",
|
|
8
|
+
"session.failed",
|
|
9
|
+
"session.expired",
|
|
10
|
+
"refund.created",
|
|
11
|
+
];
|
|
12
|
+
const STATUS_BY_EVENT = {
|
|
13
|
+
"session.succeeded": "succeeded",
|
|
14
|
+
"session.failed": "failed",
|
|
15
|
+
"session.expired": "expired",
|
|
16
|
+
"refund.created": undefined,
|
|
17
|
+
};
|
|
18
|
+
function buildPayload(event, opts) {
|
|
19
|
+
const hasTransaction = event === "session.succeeded" || event === "refund.created";
|
|
20
|
+
return {
|
|
21
|
+
event,
|
|
22
|
+
sessionId: opts.sessionId ?? `session_test_${randomUUID().slice(0, 8)}`,
|
|
23
|
+
merchantId: `merchant_test_${randomUUID().slice(0, 8)}`,
|
|
24
|
+
amount: opts.amount ?? 1499,
|
|
25
|
+
currency: opts.currency ?? "USD",
|
|
26
|
+
status: STATUS_BY_EVENT[event],
|
|
27
|
+
transactionId: hasTransaction
|
|
28
|
+
? `txn_test_${randomUUID().slice(0, 8)}`
|
|
29
|
+
: undefined,
|
|
30
|
+
timestamp: new Date().toISOString(),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function triggerCommand() {
|
|
34
|
+
return new Command("trigger")
|
|
35
|
+
.description("Send a test webhook event to a local URL")
|
|
36
|
+
.argument("<event>", `Event type (${SUPPORTED_EVENTS.join(", ")})`)
|
|
37
|
+
.requiredOption("--url <url>", "Local webhook URL (e.g. http://localhost:3000/webhooks)")
|
|
38
|
+
.option("--session-id <id>", "Custom session ID")
|
|
39
|
+
.option("--amount <cents>", "Amount in minor units", (v) => parseInt(v, 10))
|
|
40
|
+
.option("--currency <code>", "Currency code")
|
|
41
|
+
.action(async (event, opts) => {
|
|
42
|
+
if (!SUPPORTED_EVENTS.includes(event)) {
|
|
43
|
+
console.error(chalk.red(`Unknown event: ${event}\nSupported: ${SUPPORTED_EVENTS.join(", ")}`));
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
const apiKey = requireApiKey();
|
|
47
|
+
const payload = buildPayload(event, opts);
|
|
48
|
+
const body = JSON.stringify(payload);
|
|
49
|
+
const signature = createHmac("sha256", apiKey)
|
|
50
|
+
.update(body)
|
|
51
|
+
.digest("hex");
|
|
52
|
+
const timestamp = new Date().toISOString();
|
|
53
|
+
const spinner = ora(`Sending ${event} to ${opts.url}...`).start();
|
|
54
|
+
try {
|
|
55
|
+
const response = await fetch(opts.url, {
|
|
56
|
+
method: "POST",
|
|
57
|
+
headers: {
|
|
58
|
+
"Content-Type": "application/json",
|
|
59
|
+
"X-VonPay-Signature": signature,
|
|
60
|
+
"X-VonPay-Timestamp": timestamp,
|
|
61
|
+
"User-Agent": "VonPay-Webhook/1.0 (CLI trigger)",
|
|
62
|
+
},
|
|
63
|
+
body,
|
|
64
|
+
signal: AbortSignal.timeout(10_000),
|
|
65
|
+
});
|
|
66
|
+
spinner.stop();
|
|
67
|
+
if (response.ok) {
|
|
68
|
+
console.log(chalk.green(`✓ ${event} delivered → ${response.status}`));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
console.log(chalk.yellow(`⚠ ${event} delivered but got ${response.status} response`));
|
|
72
|
+
}
|
|
73
|
+
console.log(chalk.dim(` Session: ${payload.sessionId}`));
|
|
74
|
+
console.log(chalk.dim(` Amount: ${payload.amount} ${payload.currency}`));
|
|
75
|
+
console.log(chalk.dim(`\n Verify with: vonpay.webhooks.constructEvent(rawBody, sig, apiKey)`));
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
spinner.stop();
|
|
79
|
+
if (err instanceof Error && err.name === "TimeoutError") {
|
|
80
|
+
console.error(chalk.red(`Timeout: ${opts.url} did not respond within 10s`));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
console.error(chalk.red(`Failed to deliver: ${err instanceof Error ? err.message : err}`));
|
|
84
|
+
}
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=trigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger.js","sourceRoot":"","sources":["../../src/commands/trigger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,gBAAgB,GAAG;IACvB,mBAAmB;IACnB,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;CACR,CAAC;AAGX,MAAM,eAAe,GAA+C;IAClE,mBAAmB,EAAE,WAAW;IAChC,gBAAgB,EAAE,QAAQ;IAC1B,iBAAiB,EAAE,SAAS;IAC5B,gBAAgB,EAAE,SAAS;CAC5B,CAAC;AAEF,SAAS,YAAY,CACnB,KAAqB,EACrB,IAAgE;IAEhE,MAAM,cAAc,GAClB,KAAK,KAAK,mBAAmB,IAAI,KAAK,KAAK,gBAAgB,CAAC;IAC9D,OAAO;QACL,KAAK;QACL,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,gBAAgB,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;QACvE,UAAU,EAAE,iBAAiB,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;QACvD,M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IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YAC3E,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,GAAG,CACP,uEAAuE,CACxE,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBACxD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,GAAG,6BAA6B,CAAC,CAAC,CAAC;YAC9E,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CACX,KAAK,CAAC,GAAG,CACP,sBAAsB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CACjE,CACF,CAAC;YACJ,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface CliConfig {
|
|
2
|
+
checkout?: {
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export declare function loadConfig(): CliConfig;
|
|
8
|
+
export declare function saveConfig(config: CliConfig): void;
|
|
9
|
+
export declare function getApiKey(): string | undefined;
|
|
10
|
+
export declare function requireApiKey(): string;
|
|
11
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE;QACT,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,wBAAgB,UAAU,IAAI,SAAS,CAUtC;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAQlD;AAED,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAO9C;AAED,wBAAgB,aAAa,IAAI,MAAM,CAStC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
const CONFIG_DIR = join(homedir(), ".vonpay");
|
|
5
|
+
const CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
6
|
+
export function loadConfig() {
|
|
7
|
+
if (!existsSync(CONFIG_FILE))
|
|
8
|
+
return {};
|
|
9
|
+
try {
|
|
10
|
+
return JSON.parse(readFileSync(CONFIG_FILE, "utf-8"));
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
console.error("Warning: ~/.vonpay/config.json is malformed. Run `vonpay checkout login` to reset it.");
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function saveConfig(config) {
|
|
18
|
+
if (!existsSync(CONFIG_DIR)) {
|
|
19
|
+
mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
|
|
20
|
+
}
|
|
21
|
+
writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2) + "\n", {
|
|
22
|
+
encoding: "utf-8",
|
|
23
|
+
mode: 0o600,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export function getApiKey() {
|
|
27
|
+
// Env var takes precedence
|
|
28
|
+
const envKey = process.env.VON_PAY_SECRET_KEY;
|
|
29
|
+
if (envKey)
|
|
30
|
+
return envKey;
|
|
31
|
+
const config = loadConfig();
|
|
32
|
+
return config.checkout?.apiKey;
|
|
33
|
+
}
|
|
34
|
+
export function requireApiKey() {
|
|
35
|
+
const key = getApiKey();
|
|
36
|
+
if (!key) {
|
|
37
|
+
console.error("No API key found. Run `vonpay checkout login` or set VON_PAY_SECRET_KEY.");
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
return key;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;AAC9C,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AASpD,MAAM,UAAU,UAAU;IACxB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,CAAC;IACxC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAc,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,KAAK,CACX,uFAAuF,CACxF,CAAC;QACF,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAiB;IAC1C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE;QACjE,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,2BAA2B;IAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAC9C,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,OAAO,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;IACxB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,CAAC,KAAK,CACX,0EAA0E,CAC3E,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { registerCheckout } from "./commands/checkout.js";
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
|
|
9
|
+
const program = new Command();
|
|
10
|
+
program
|
|
11
|
+
.name("vonpay")
|
|
12
|
+
.description("Von Payments developer tools")
|
|
13
|
+
.version(pkg.version);
|
|
14
|
+
registerCheckout(program);
|
|
15
|
+
program.parse();
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CACpB,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAC7D,CAAC;AAEF,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,8BAA8B,CAAC;KAC3C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAExB,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAE1B,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vonpay/checkout-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Von Payments CLI — developer tools for checkout integration",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"vonpay": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=20"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"commander": "^13.0.0",
|
|
22
|
+
"chalk": "^5.4.0",
|
|
23
|
+
"ora": "^8.2.0",
|
|
24
|
+
"@vonpay/checkout-node": "0.1.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"typescript": "^5.7.0",
|
|
28
|
+
"vitest": "^3.0.0"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"vonpay",
|
|
32
|
+
"payments",
|
|
33
|
+
"checkout",
|
|
34
|
+
"cli"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc",
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"test": "vitest run",
|
|
40
|
+
"clean": "rm -rf dist"
|
|
41
|
+
}
|
|
42
|
+
}
|