dodopayments-cli 2.0.2 → 2.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 +30 -7
- package/build-binaries.ts +27 -4
- package/dist/index.js +22 -22
- package/package.json +3 -3
- package/dodo-webhooks/functions/generate-dispute-data.ts +0 -123
- package/dodo-webhooks/functions/generate-licence-data.ts +0 -39
- package/dodo-webhooks/functions/generate-payment-data.ts +0 -101
- package/dodo-webhooks/functions/generate-refund-data.ts +0 -44
- package/dodo-webhooks/functions/generate-subscription-data.ts +0 -153
- package/dodo-webhooks/functions/supported-events.ts +0 -24
- package/dodo-webhooks/index.ts +0 -207
- package/dodo-webhooks/types/baseArgs.ts +0 -9
- package/index.ts +0 -494
- package/utils/currency-to-symbol-map.ts +0 -8
package/README.md
CHANGED
|
@@ -74,6 +74,8 @@ This command will:
|
|
|
74
74
|
3. Ask you to select the environment (**Test Mode** or **Live Mode**)
|
|
75
75
|
4. Store your credentials locally to `~/.dodopayments/api-key`
|
|
76
76
|
|
|
77
|
+
Note: Upto 1 Test Mode & 1 Live Mode can be used at the same time
|
|
78
|
+
|
|
77
79
|
## Usage
|
|
78
80
|
|
|
79
81
|
The general syntax is:
|
|
@@ -129,19 +131,40 @@ Manage software licenses.
|
|
|
129
131
|
|---------|-------------|
|
|
130
132
|
| `dodo licences list` | List all licenses |
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
### Addons
|
|
133
135
|
|
|
134
|
-
|
|
136
|
+
Manage your add-ons.
|
|
135
137
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
| Command | Description |
|
|
139
|
+
|---------|-------------|
|
|
140
|
+
| `dodo addons list` | List all addons |
|
|
141
|
+
| `dodo addons create` | Open dashboard to create an addon |
|
|
142
|
+
| `dodo addons info` | View details for a specific addon |
|
|
143
|
+
|
|
144
|
+
### Refunds
|
|
145
|
+
|
|
146
|
+
Manage your refunds.
|
|
147
|
+
|
|
148
|
+
| Command | Description |
|
|
149
|
+
|---------|-------------|
|
|
150
|
+
| `dodo refund list` | List all refunds |
|
|
151
|
+
| `dodo refund info` | View details for a specific refund |
|
|
152
|
+
|
|
153
|
+
### Webhooks
|
|
154
|
+
|
|
155
|
+
Manage and test webhooks directly from the CLI.
|
|
156
|
+
|
|
157
|
+
| Command | Description |
|
|
158
|
+
|---------|-------------|
|
|
159
|
+
| `dodo wh listen` | Listen for webhooks from Dodo Payments in real time and forward them to your local dev server |
|
|
160
|
+
| `dodo wh trigger` | Trigger a test webhook event interactively |
|
|
161
|
+
|
|
162
|
+
> **Note:** The webhook triggering doesn't support signing requests yet. Please disable webhook signature verification while triggering. A simple way to do this is using `unsafe_unwrap()` instead of `unwrap()` in the webhook endpoint **during testing only**.
|
|
139
163
|
|
|
140
|
-
> **Note:** The webhook
|
|
164
|
+
> **Note:** The webhook listening tool will only work with a test mode API key. If you use a live mode API key, it won't work.
|
|
141
165
|
|
|
142
166
|
This interactive tool guides you through:
|
|
143
167
|
1. Setting a destination **endpoint URL**
|
|
144
|
-
2. Configuring **Business ID**, **Product ID**, and **Metadata**
|
|
145
168
|
3. Selecting a specific **Event** to trigger
|
|
146
169
|
|
|
147
170
|
### Supported Webhook Events
|
package/build-binaries.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { rename, rm } from "node:fs/promises";
|
|
2
|
+
|
|
1
3
|
const targets: any = [
|
|
2
4
|
"bun-darwin-x64",
|
|
3
5
|
"bun-darwin-arm64",
|
|
@@ -8,15 +10,36 @@ const targets: any = [
|
|
|
8
10
|
|
|
9
11
|
// Loop through all targets and build them
|
|
10
12
|
for (const target of targets) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
const targetName = target.replace('bun-', '');
|
|
14
|
+
const tempDir = `./dist/temp-${targetName}`;
|
|
15
|
+
|
|
16
|
+
const build = await Bun.build({
|
|
17
|
+
entrypoints: ["./src/index.ts"],
|
|
18
|
+
outdir: tempDir,
|
|
14
19
|
target: "bun",
|
|
15
20
|
compile: {
|
|
16
21
|
// `as any` cause Bun doesn't provide type of exact platforms
|
|
17
22
|
target: target as any,
|
|
18
|
-
}
|
|
23
|
+
},
|
|
19
24
|
});
|
|
25
|
+
|
|
26
|
+
const artifact = build.outputs[0];
|
|
27
|
+
if (build.success && artifact) {
|
|
28
|
+
const binaryPath = artifact.path;
|
|
29
|
+
|
|
30
|
+
if (binaryPath) {
|
|
31
|
+
let finalName = `dodo-cli-${targetName}`;
|
|
32
|
+
if (target.includes("windows")) {
|
|
33
|
+
finalName += ".exe";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
await rename(binaryPath, `./dist/${finalName}`);
|
|
37
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
38
|
+
console.log(`Successfully built ${finalName}`);
|
|
39
|
+
} else {
|
|
40
|
+
console.error(`Build successful but artifact path missing for ${target}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
20
43
|
}
|
|
21
44
|
|
|
22
45
|
console.log(`Build complete! Binaries are in ./dist`);
|