@uqpay/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/LICENSE +21 -0
- package/README.md +207 -0
- package/package.json +32 -0
- package/scripts/install.js +88 -0
- package/scripts/run.js +12 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 UQPAY
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# uqpay-cli
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://go.dev/)
|
|
5
|
+
[](https://www.npmjs.com/package/@uqpay/cli)
|
|
6
|
+
|
|
7
|
+
The official [UQPAY](https://www.uqpay.com/) CLI tool — built for humans and AI Agents. Covers Banking, Card Issuing, and Payment APIs with 100+ commands and 6 AI Agent [Skills](./skills/).
|
|
8
|
+
|
|
9
|
+
[Install](#installation) · [Quick Start](#quick-start) · [AI Agent Skills](#agent-skills) · [Commands](#command-structure) · [Advanced](#advanced-usage) · [Contributing](#contributing)
|
|
10
|
+
|
|
11
|
+
## Why uqpay-cli?
|
|
12
|
+
|
|
13
|
+
- **Agent-Native Design** — 6 structured [Skills](./skills/) out of the box, AI Agents can operate UQPAY APIs with zero extra setup
|
|
14
|
+
- **Wide Coverage** — 3 business domains (Banking, Issuing, Payment), 100+ commands, Connect & Simulator included
|
|
15
|
+
- **Zero Type Hassle** — All values default to strings, number fields auto-converted per API spec — just type `-d amount=100` and it works
|
|
16
|
+
- **Open Source** — MIT license, `npm install` and go
|
|
17
|
+
- **Up and Running in 1 Minute** — Set credentials, start calling APIs
|
|
18
|
+
- **Cross-Platform** — macOS, Linux, Windows (amd64 & arm64)
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
| Domain | Capabilities |
|
|
23
|
+
|--------|-------------|
|
|
24
|
+
| 🏦 Banking | Balances, transfers, deposits, payouts, beneficiaries, FX conversions, exchange rates, virtual accounts |
|
|
25
|
+
| 💳 Issuing | Card products, cardholders, virtual/physical cards, recharge/withdraw, transactions, spending controls, reports |
|
|
26
|
+
| 💰 Payment | Payment intents, attempts, refunds, settlements, bank accounts, payouts |
|
|
27
|
+
| 🔗 Connect | Connected accounts, sub-account onboarding (COMPANY/INDIVIDUAL), KYC document upload |
|
|
28
|
+
| 🧪 Simulator | Sandbox-only: simulate deposits, card authorizations, reversals |
|
|
29
|
+
| 📁 File | Upload files, get download links |
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
### From npm (recommended)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install -g @uqpay/cli
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### From source
|
|
40
|
+
|
|
41
|
+
Requires Go 1.21+.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
git clone https://github.com/uqpay/uqpay-cli.git
|
|
45
|
+
cd uqpay-cli
|
|
46
|
+
make install
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Enable tab completion (optional)
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
uqpay setup-completion
|
|
53
|
+
source ~/.zshrc # or ~/.bashrc
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# 1. Configure credentials (one-time)
|
|
60
|
+
uqpay config set client-id YOUR_CLIENT_ID
|
|
61
|
+
uqpay config set api-key YOUR_API_KEY
|
|
62
|
+
uqpay config set env sandbox
|
|
63
|
+
|
|
64
|
+
# 2. Start using
|
|
65
|
+
uqpay banking balance list
|
|
66
|
+
uqpay issuing card list
|
|
67
|
+
uqpay payment intent list
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Or inline without config file:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
uqpay --env sandbox --client-id ID --api-key KEY banking balance list
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Quick Start (AI Agent)
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Step 1 — Install
|
|
80
|
+
npm install -g @uqpay/cli
|
|
81
|
+
|
|
82
|
+
# Step 2 — Configure (provide credentials from UQPAY dashboard)
|
|
83
|
+
uqpay config set client-id <CLIENT_ID>
|
|
84
|
+
uqpay config set api-key <API_KEY>
|
|
85
|
+
uqpay config set env sandbox
|
|
86
|
+
|
|
87
|
+
# Step 3 — Verify
|
|
88
|
+
uqpay banking balance list
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Agent Skills
|
|
92
|
+
|
|
93
|
+
Located in [`skills/`](./skills/), these provide structured guides for AI Agents to operate UQPAY APIs correctly.
|
|
94
|
+
|
|
95
|
+
| Skill | Description |
|
|
96
|
+
|-------|-------------|
|
|
97
|
+
| [`uqpay-shared`](./skills/uqpay-shared/SKILL.md) | Configuration, authentication, global flags, data conventions, auto number coercion |
|
|
98
|
+
| [`uqpay-banking`](./skills/uqpay-banking/SKILL.md) | Balances, beneficiaries, payouts, conversions, transfers, deposits, virtual accounts |
|
|
99
|
+
| [`uqpay-issuing`](./skills/uqpay-issuing/SKILL.md) | Cards, cardholders, products, transactions, transfers, reports |
|
|
100
|
+
| [`uqpay-payment`](./skills/uqpay-payment/SKILL.md) | Payment intents, attempts, refunds, settlements, bank accounts, payouts |
|
|
101
|
+
| [`uqpay-connect`](./skills/uqpay-connect/SKILL.md) | Connected accounts, sub-account onboarding, `--on-behalf-of` operations |
|
|
102
|
+
| [`uqpay-simulate`](./skills/uqpay-simulate/SKILL.md) | Sandbox testing: deposits, authorizations, reversals |
|
|
103
|
+
|
|
104
|
+
## Command Structure
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
uqpay <domain> <resource> <action> [flags]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Domains
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
uqpay banking balance list # Banking API
|
|
114
|
+
uqpay issuing card list # Issuing API
|
|
115
|
+
uqpay payment intent list # Payment API
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Other Commands
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
uqpay account list # Connected accounts (Connect API)
|
|
122
|
+
uqpay config get # CLI configuration
|
|
123
|
+
uqpay file upload ./doc.pdf # File upload
|
|
124
|
+
uqpay simulate deposit -d ... # Sandbox simulator
|
|
125
|
+
uqpay setup-completion # Install shell tab-completion
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Shortcuts
|
|
129
|
+
|
|
130
|
+
Top-level aliases for common resources:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
uqpay beneficiary list # = uqpay banking beneficiary list
|
|
134
|
+
uqpay card list # = uqpay issuing card list
|
|
135
|
+
uqpay payout list # = uqpay banking payout list
|
|
136
|
+
uqpay conversion list # = uqpay banking conversion list
|
|
137
|
+
uqpay cardholder list # = uqpay issuing cardholder list
|
|
138
|
+
uqpay exchange-rate list # = uqpay banking exchange-rate list
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Data Passing
|
|
142
|
+
|
|
143
|
+
**Read operations** use flags, **write operations** use `-d key=value`:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Read (GET)
|
|
147
|
+
uqpay banking beneficiary list --page-num 2 --page-size 20
|
|
148
|
+
|
|
149
|
+
# Write (POST) — dot notation for nested objects
|
|
150
|
+
uqpay banking beneficiary create \
|
|
151
|
+
-d entity_type=INDIVIDUAL \
|
|
152
|
+
-d first_name=John \
|
|
153
|
+
-d last_name=Doe \
|
|
154
|
+
-d bank_details.swift_code=DBSSSGSG \
|
|
155
|
+
-d bank_details.account_number=1234567890
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
All values are strings by default. Number fields (like `amount` in card recharge) are auto-converted — no prefix needed.
|
|
159
|
+
|
|
160
|
+
## Advanced Usage
|
|
161
|
+
|
|
162
|
+
### Output Formats
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
uqpay banking balance list # table (default)
|
|
166
|
+
uqpay banking balance list -o json # JSON
|
|
167
|
+
uqpay banking balance list -o yaml # YAML
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Debug Mode
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
uqpay --debug banking balance list # Print HTTP request/response details
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Sub-Account Operations
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
uqpay --on-behalf-of <account-id> banking balance list
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### File Encoding
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Pure base64 (issuing identity documents)
|
|
186
|
+
-d identity.front_file=@./passport.jpg
|
|
187
|
+
|
|
188
|
+
# Data URI (connect account documents)
|
|
189
|
+
-d "certification[0]=@+./cert.png"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Environment Variables
|
|
193
|
+
|
|
194
|
+
| Variable | Description |
|
|
195
|
+
|----------|-------------|
|
|
196
|
+
| `UQPAY_CLIENT_ID` | Override client ID |
|
|
197
|
+
| `UQPAY_API_KEY` | Override API key |
|
|
198
|
+
| `UQPAY_ENV` | Override environment (sandbox/production) |
|
|
199
|
+
| `UQPAY_OUTPUT` | Override output format |
|
|
200
|
+
|
|
201
|
+
## Contributing
|
|
202
|
+
|
|
203
|
+
Contributions welcome! Please submit an [Issue](https://github.com/uqpay/uqpay-cli/issues) or [Pull Request](https://github.com/uqpay/uqpay-cli/pulls).
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
[MIT](./LICENSE)
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@uqpay/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "UQPAY command-line tool for banking, issuing, and payment APIs",
|
|
5
|
+
"bin": {
|
|
6
|
+
"uqpay": "scripts/run.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node scripts/install.js"
|
|
10
|
+
},
|
|
11
|
+
"os": [
|
|
12
|
+
"darwin",
|
|
13
|
+
"linux",
|
|
14
|
+
"win32"
|
|
15
|
+
],
|
|
16
|
+
"cpu": [
|
|
17
|
+
"x64",
|
|
18
|
+
"arm64"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=16"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/uqpay/uqpay-cli.git"
|
|
26
|
+
},
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"files": [
|
|
29
|
+
"scripts/install.js",
|
|
30
|
+
"scripts/run.js"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const { execSync } = require("child_process");
|
|
4
|
+
const os = require("os");
|
|
5
|
+
|
|
6
|
+
const VERSION = require("../package.json").version;
|
|
7
|
+
const REPO = "uqpay/uqpay-cli";
|
|
8
|
+
const NAME = "uqpay";
|
|
9
|
+
|
|
10
|
+
const PLATFORM_MAP = {
|
|
11
|
+
darwin: "darwin",
|
|
12
|
+
linux: "linux",
|
|
13
|
+
win32: "windows",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const ARCH_MAP = {
|
|
17
|
+
x64: "amd64",
|
|
18
|
+
arm64: "arm64",
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const platform = PLATFORM_MAP[process.platform];
|
|
22
|
+
const arch = ARCH_MAP[process.arch];
|
|
23
|
+
|
|
24
|
+
if (!platform || !arch) {
|
|
25
|
+
console.error(
|
|
26
|
+
`Unsupported platform: ${process.platform}-${process.arch}`
|
|
27
|
+
);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const isWindows = process.platform === "win32";
|
|
32
|
+
const ext = isWindows ? ".zip" : ".tar.gz";
|
|
33
|
+
const archiveName = `${NAME}-${VERSION}-${platform}-${arch}${ext}`;
|
|
34
|
+
const GITHUB_URL = `https://github.com/${REPO}/releases/download/v${VERSION}/${archiveName}`;
|
|
35
|
+
|
|
36
|
+
const binDir = path.join(__dirname, "..", "bin");
|
|
37
|
+
const dest = path.join(binDir, NAME + (isWindows ? ".exe" : ""));
|
|
38
|
+
|
|
39
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
40
|
+
|
|
41
|
+
function download(url, destPath) {
|
|
42
|
+
const sslFlag = isWindows ? "--ssl-revoke-best-effort " : "";
|
|
43
|
+
execSync(
|
|
44
|
+
`curl ${sslFlag}--fail --location --silent --show-error --connect-timeout 10 --max-time 120 --output "${destPath}" "${url}"`,
|
|
45
|
+
{ stdio: ["ignore", "ignore", "pipe"] }
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function install() {
|
|
50
|
+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "uqpay-cli-"));
|
|
51
|
+
const archivePath = path.join(tmpDir, archiveName);
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
download(GITHUB_URL, archivePath);
|
|
55
|
+
|
|
56
|
+
if (isWindows) {
|
|
57
|
+
execSync(
|
|
58
|
+
`powershell -Command "Expand-Archive -Path '${archivePath}' -DestinationPath '${tmpDir}'"`,
|
|
59
|
+
{ stdio: "ignore" }
|
|
60
|
+
);
|
|
61
|
+
} else {
|
|
62
|
+
execSync(`tar -xzf "${archivePath}" -C "${tmpDir}"`, {
|
|
63
|
+
stdio: "ignore",
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const binaryName = NAME + (isWindows ? ".exe" : "");
|
|
68
|
+
const extractedBinary = path.join(tmpDir, binaryName);
|
|
69
|
+
|
|
70
|
+
fs.copyFileSync(extractedBinary, dest);
|
|
71
|
+
fs.chmodSync(dest, 0o755);
|
|
72
|
+
console.log(`${NAME} v${VERSION} installed successfully`);
|
|
73
|
+
} finally {
|
|
74
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
install();
|
|
80
|
+
} catch (err) {
|
|
81
|
+
console.error(`Failed to install ${NAME}:`, err.message);
|
|
82
|
+
console.error(
|
|
83
|
+
`\nIf you are behind a firewall, try setting a proxy:\n` +
|
|
84
|
+
` export https_proxy=http://your-proxy:port\n` +
|
|
85
|
+
` npm install -g @uqpay/cli`
|
|
86
|
+
);
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
package/scripts/run.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { execFileSync } = require("child_process");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
6
|
+
const bin = path.join(__dirname, "..", "bin", "uqpay" + ext);
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
execFileSync(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
10
|
+
} catch (e) {
|
|
11
|
+
process.exit(e.status || 1);
|
|
12
|
+
}
|