taiwan-payment-skill 1.0.0 → 1.0.2
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 +1 -1
- package/assets/taiwan-payment/README.md +197 -306
- package/assets/taiwan-payment/examples/ecpay-payment-example.py +390 -0
- package/assets/taiwan-payment/examples/newebpay-payment-example.py +451 -0
- package/assets/taiwan-payment/examples/payuni-payment-example.py +457 -0
- package/package.json +12 -10
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<a href="https://www.npmjs.com/package/taiwan-payment-skill"><img src="https://img.shields.io/npm/dm/taiwan-payment-skill?style=flat-square&label=downloads" alt="npm downloads"></a>
|
|
12
12
|
<img src="https://img.shields.io/badge/node-%3E%3D18-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node.js">
|
|
13
13
|
<img src="https://img.shields.io/badge/platforms-14-blue?style=flat-square" alt="14 Platforms">
|
|
14
|
-
<a href="https://github.com/Moksa1123/taiwan-
|
|
14
|
+
<a href="https://github.com/Moksa1123/taiwan-invoice/blob/main/LICENSE"><img src="https://img.shields.io/github/license/Moksa1123/taiwan-invoice?style=flat-square" alt="License"></a>
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
17
|
<p align="center">
|
|
@@ -1,306 +1,197 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
#
|
|
54
|
-
taiwan-payment init
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
taiwan-payment init --ai
|
|
58
|
-
taiwan-payment init --ai
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
###
|
|
165
|
-
|
|
166
|
-
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
### NewebPay MPG Integration
|
|
200
|
-
|
|
201
|
-
```typescript
|
|
202
|
-
import { createPayment } from './newebpay-service';
|
|
203
|
-
|
|
204
|
-
const order = {
|
|
205
|
-
merchantId: 'YOUR_MERCHANT_ID',
|
|
206
|
-
orderId: `ORDER${Date.now()}`,
|
|
207
|
-
amount: 2500,
|
|
208
|
-
description: 'E-commerce Order',
|
|
209
|
-
returnUrl: 'https://example.com/notify',
|
|
210
|
-
paymentMethod: 'CREDIT,VACC,CVS' // Multiple methods
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
const form = await createPayment(order);
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### PAYUNi RESTful API
|
|
217
|
-
|
|
218
|
-
```typescript
|
|
219
|
-
import axios from 'axios';
|
|
220
|
-
import { encryptPayUni } from './encryption';
|
|
221
|
-
|
|
222
|
-
const order = {
|
|
223
|
-
MerID: 'YOUR_MERCHANT_ID',
|
|
224
|
-
MerTradeNo: `ORDER${Date.now()}`,
|
|
225
|
-
TradeAmt: 3000,
|
|
226
|
-
ProdDesc: 'Subscription Service',
|
|
227
|
-
ReturnURL: 'https://example.com/callback',
|
|
228
|
-
PayType: 'Credit'
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
const { encryptInfo, hashInfo } = encryptPayUni(order);
|
|
232
|
-
const response = await axios.post('https://sandbox-api.payuni.com.tw/api/upp', {
|
|
233
|
-
MerID: order.MerID,
|
|
234
|
-
EncryptInfo: encryptInfo,
|
|
235
|
-
HashInfo: hashInfo
|
|
236
|
-
});
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
---
|
|
240
|
-
|
|
241
|
-
## Data-Driven Architecture
|
|
242
|
-
|
|
243
|
-
All business logic is stored in CSV files for easy maintenance:
|
|
244
|
-
|
|
245
|
-
- **providers.csv**: Provider configurations (encryption, test accounts, API endpoints)
|
|
246
|
-
- **operations.csv**: API operations (create, query, refund, recurring)
|
|
247
|
-
- **error-codes.csv**: Error code mappings with solutions
|
|
248
|
-
- **field-mappings.csv**: Field name translations across providers
|
|
249
|
-
- **payment-methods.csv**: Payment method specifications
|
|
250
|
-
- **reasoning.csv**: Recommendation rules (30+ business scenarios)
|
|
251
|
-
- **troubleshooting.csv**: Common issues and solutions (16 cases)
|
|
252
|
-
|
|
253
|
-
---
|
|
254
|
-
|
|
255
|
-
## Development Requirements
|
|
256
|
-
|
|
257
|
-
- **Node.js** >= 18.0.0 (CLI tool)
|
|
258
|
-
- **Python** >= 3.x (intelligent scripts, no external dependencies)
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
## Documentation
|
|
263
|
-
|
|
264
|
-
- [SKILL.md](./SKILL.md) - Complete skill documentation (857 lines)
|
|
265
|
-
- [EXAMPLES.md](./EXAMPLES.md) - 9 production-ready code examples (1425 lines)
|
|
266
|
-
- [CLAUDE.md](./CLAUDE.md) - Development guide for Claude Code
|
|
267
|
-
|
|
268
|
-
### API References
|
|
269
|
-
|
|
270
|
-
- [ECPay Payment API](./references/ECPAY_PAYMENT_REFERENCE.md)
|
|
271
|
-
- [NewebPay Payment API](./references/NEWEBPAY_PAYMENT_REFERENCE.md)
|
|
272
|
-
- [PAYUNi Payment API](./references/PAYUNI_PAYMENT_REFERENCE.md)
|
|
273
|
-
|
|
274
|
-
---
|
|
275
|
-
|
|
276
|
-
## License
|
|
277
|
-
|
|
278
|
-
[MIT License](https://opensource.org/licenses/MIT)
|
|
279
|
-
|
|
280
|
-
---
|
|
281
|
-
|
|
282
|
-
## Related Projects
|
|
283
|
-
|
|
284
|
-
- [taiwan-invoice-skill](https://github.com/Moksa1123/taiwan-invoice) - Taiwan E-Invoice integration
|
|
285
|
-
- [taiwan-logistics-skill](https://github.com/Moksa1123/taiwan-logistics) - Taiwan logistics integration
|
|
286
|
-
|
|
287
|
-
---
|
|
288
|
-
|
|
289
|
-
## Support
|
|
290
|
-
|
|
291
|
-
- **Official Documentation**: See `references/` directory
|
|
292
|
-
- **Technical Support**:
|
|
293
|
-
- ECPay: techsupport@ecpay.com.tw
|
|
294
|
-
- NewebPay: 02-2655-8938
|
|
295
|
-
- PAYUNi: 02-2747-5100
|
|
296
|
-
|
|
297
|
-
---
|
|
298
|
-
|
|
299
|
-
<p align="center">
|
|
300
|
-
<sub>Professional toolkit by <strong>Moksa</strong></sub><br>
|
|
301
|
-
<sub>service@moksaweb.com</sub>
|
|
302
|
-
</p>
|
|
303
|
-
|
|
304
|
-
<p align="center">
|
|
305
|
-
<sub>Last updated: 2026-01-29</sub>
|
|
306
|
-
</p>
|
|
1
|
+
<h1 align="center">taiwan-payment-skill</h1>
|
|
2
|
+
|
|
3
|
+
<h3 align="center">台灣金流 AI 開發技能包</h3>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>支援 ECPay 綠界 · NewebPay 藍新 · PAYUNi 統一</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/taiwan-payment-skill"><img src="https://img.shields.io/npm/v/taiwan-payment-skill?style=flat-square&logo=npm" alt="npm version"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/taiwan-payment-skill"><img src="https://img.shields.io/npm/dm/taiwan-payment-skill?style=flat-square&label=downloads" alt="npm downloads"></a>
|
|
12
|
+
<img src="https://img.shields.io/badge/node-%3E%3D18-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node.js">
|
|
13
|
+
<img src="https://img.shields.io/badge/platforms-14-blue?style=flat-square" alt="14 Platforms">
|
|
14
|
+
<a href="https://github.com/Moksa1123/taiwan-invoice/blob/main/LICENSE"><img src="https://img.shields.io/github/license/Moksa1123/taiwan-invoice?style=flat-square" alt="License"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<a href="https://paypal.me/cccsubcom"><img src="https://img.shields.io/badge/PayPal-支持開發-00457C?style=for-the-badge&logo=paypal&logoColor=white" alt="PayPal"></a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 安裝
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g taiwan-payment-skill
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 使用方式
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# 進入專案目錄
|
|
35
|
+
cd /path/to/your/project
|
|
36
|
+
|
|
37
|
+
# 選擇你的 AI 助手
|
|
38
|
+
taiwan-payment init --ai claude # Claude Code
|
|
39
|
+
taiwan-payment init --ai cursor # Cursor
|
|
40
|
+
taiwan-payment init --ai windsurf # Windsurf
|
|
41
|
+
taiwan-payment init --ai copilot # GitHub Copilot
|
|
42
|
+
taiwan-payment init --ai antigravity # Antigravity
|
|
43
|
+
taiwan-payment init --ai all # 全部安裝
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
<details>
|
|
47
|
+
<summary>完整平台列表</summary>
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
taiwan-payment init --ai kiro # Kiro (AWS)
|
|
51
|
+
taiwan-payment init --ai codex # Codex CLI (OpenAI)
|
|
52
|
+
taiwan-payment init --ai qoder # Qoder
|
|
53
|
+
taiwan-payment init --ai roocode # Roo Code
|
|
54
|
+
taiwan-payment init --ai gemini # Gemini CLI
|
|
55
|
+
taiwan-payment init --ai trae # Trae (ByteDance)
|
|
56
|
+
taiwan-payment init --ai opencode # OpenCode
|
|
57
|
+
taiwan-payment init --ai continue # Continue
|
|
58
|
+
taiwan-payment init --ai codebuddy # CodeBuddy (Tencent)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
</details>
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 其他指令
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
taiwan-payment list # 列出支援平台
|
|
69
|
+
taiwan-payment info # 顯示技能資訊
|
|
70
|
+
taiwan-payment versions # 列出可用版本
|
|
71
|
+
taiwan-payment update # 檢查更新
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 選項
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
taiwan-payment init --force # 覆蓋現有檔案
|
|
78
|
+
taiwan-payment init --global # 安裝到全域目錄(所有專案共用)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 全域安裝
|
|
82
|
+
|
|
83
|
+
使用 `--global` 可將技能安裝到使用者目錄,讓所有專案都能使用:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
taiwan-payment init --ai cursor --global # ~/.cursor/skills/taiwan-payment/
|
|
87
|
+
taiwan-payment init --ai claude --global # ~/.claude/skills/taiwan-payment/
|
|
88
|
+
taiwan-payment init --ai antigravity --global # ~/.gemini/antigravity/global_skills/taiwan-payment/
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 支援平台
|
|
94
|
+
|
|
95
|
+
| 平台 | 說明 | 啟動方式 |
|
|
96
|
+
|------|------|----------|
|
|
97
|
+
| **Claude Code** | Anthropic 官方 CLI | `/taiwan-payment` |
|
|
98
|
+
| **Cursor** | AI 程式編輯器 | `/taiwan-payment` |
|
|
99
|
+
| **Windsurf** | Codeium 編輯器 | 自動 |
|
|
100
|
+
| **Copilot** | GitHub Copilot | `/taiwan-payment` |
|
|
101
|
+
| **Antigravity** | Google AI 助手 | `/taiwan-payment` |
|
|
102
|
+
| **Kiro** | AWS AI 助手 | `/taiwan-payment` |
|
|
103
|
+
| **Codex** | OpenAI CLI | 自動 |
|
|
104
|
+
| **Qoder** | Qodo AI 助手 | 自動 |
|
|
105
|
+
| **RooCode** | VSCode 擴充 | `/taiwan-payment` |
|
|
106
|
+
| **Gemini CLI** | Google Gemini | 自動 |
|
|
107
|
+
| **Trae** | ByteDance AI | 自動 |
|
|
108
|
+
| **OpenCode** | 開源 AI 助手 | 自動 |
|
|
109
|
+
| **Continue** | 開源 AI 助手 | 自動 |
|
|
110
|
+
| **CodeBuddy** | Tencent AI | 自動 |
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 金流服務商
|
|
115
|
+
|
|
116
|
+
| 服務商 | 加密方式 | API 風格 | 特點 |
|
|
117
|
+
|--------|---------|---------|------|
|
|
118
|
+
| **ECPay 綠界** | URL Encode + SHA256 | Form POST | 市佔率最高,穩定性佳 |
|
|
119
|
+
| **NewebPay 藍新** | AES-256-CBC + SHA256 | Form POST + AES | 支援最多支付方式 (13 種) |
|
|
120
|
+
| **PAYUNi 統一** | AES-256-GCM + SHA256 | RESTful JSON | RESTful 設計,API 現代化 |
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 付款方式支援
|
|
125
|
+
|
|
126
|
+
### 信用卡支付
|
|
127
|
+
- 一次付清、分期付款 (3/6/12/18/24 期)
|
|
128
|
+
- 信用卡定期定額、信用卡記憶
|
|
129
|
+
|
|
130
|
+
### 電子錢包
|
|
131
|
+
- Apple Pay、Google Pay、Samsung Pay
|
|
132
|
+
- LINE Pay、台灣 Pay
|
|
133
|
+
|
|
134
|
+
### 轉帳支付
|
|
135
|
+
- 網路 ATM、ATM 虛擬帳號
|
|
136
|
+
|
|
137
|
+
### 超商支付
|
|
138
|
+
- 超商代碼、超商條碼
|
|
139
|
+
|
|
140
|
+
### 其他
|
|
141
|
+
- TWQR、BNPL 無卡分期、AFTEE 先享後付
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 智能工具
|
|
146
|
+
|
|
147
|
+
安裝後包含以下 Python 工具(純 Python,無需外部依賴):
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# BM25 搜索引擎 - 搜索錯誤碼、欄位映射、付款方式
|
|
151
|
+
python scripts/search.py "10100058" --domain error
|
|
152
|
+
python scripts/search.py "信用卡" --domain payment_method
|
|
153
|
+
python scripts/search.py "CheckMacValue" --domain troubleshoot
|
|
154
|
+
|
|
155
|
+
# 智能推薦系統 - 根據需求推薦金流服務商
|
|
156
|
+
python scripts/recommend.py "高交易量 電商 穩定"
|
|
157
|
+
python scripts/recommend.py "多元支付 LINE Pay Apple Pay"
|
|
158
|
+
|
|
159
|
+
# 連線測試工具 - 測試 API 連線
|
|
160
|
+
python scripts/test_payment.py ecpay
|
|
161
|
+
python scripts/test_payment.py all
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### 搜索域
|
|
165
|
+
|
|
166
|
+
- `provider` - 服務商比較
|
|
167
|
+
- `operation` - API 操作端點
|
|
168
|
+
- `error` - 錯誤碼查詢
|
|
169
|
+
- `field` - 欄位映射
|
|
170
|
+
- `payment_method` - 付款方式
|
|
171
|
+
- `troubleshoot` - 疑難排解
|
|
172
|
+
- `reasoning` - 推薦決策規則
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## 功能特色
|
|
177
|
+
|
|
178
|
+
- 完整 API 文檔 (ECPay, NewebPay, PAYUNi)
|
|
179
|
+
- BM25 搜索引擎 (311 行)
|
|
180
|
+
- 智能推薦系統 (373 行)
|
|
181
|
+
- 9 組完整代碼範例 (TypeScript/Python)
|
|
182
|
+
- 7 個 CSV 數據檔 (易於維護)
|
|
183
|
+
- 加密實作指南 (SHA256, AES-CBC, AES-GCM)
|
|
184
|
+
- 16 個疑難排解案例
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 授權
|
|
189
|
+
|
|
190
|
+
[MIT License](https://github.com/Moksa1123/taiwan-payment/blob/main/LICENSE)
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
<p align="center">
|
|
195
|
+
<sub>Made by <strong>Moksa</strong></sub><br>
|
|
196
|
+
<sub>service@moksaweb.com</sub>
|
|
197
|
+
</p>
|