feat(payment): 支付插件 - 合并 PR #546 易支付适配
Merge pull request #546 from qiuliw. Preserve the original author and current main behavior.
This commit is contained in:
commit
6eaeddc77c
21 files changed
+995
-2
No files matched your search
@@ -3,7 +3,7 @@ set -eu
|
||||
|
||||
root_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
repo_dir=$(CDPATH= cd -- "$root_dir/.." && pwd)
|
||||
payment_plugins="official-payment-wechat-native official-payment-alipay-page official-payment-xunhupay official-payment-zhifufm"
|
||||
payment_plugins="official-payment-wechat-native official-payment-alipay-page official-payment-xunhupay official-payment-zhifufm official-payment-epay"
|
||||
payments_only=false
|
||||
default_payment_targets="linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64 windows/arm64"
|
||||
|
||||
@@ -119,6 +119,7 @@ for target in $payment_targets; do
|
||||
build_payment_provider official-payment-alipay-page ./cmd/payment-alipay "$target_goos" "$target_goarch"
|
||||
build_payment_provider official-payment-xunhupay ./cmd/payment-xunhupay "$target_goos" "$target_goarch"
|
||||
build_payment_provider official-payment-zhifufm ./cmd/payment-zhifufm "$target_goos" "$target_goarch"
|
||||
build_payment_provider official-payment-epay ./cmd/payment-epay "$target_goos" "$target_goarch"
|
||||
done
|
||||
|
||||
package_plugin() {
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
# 易支付
|
||||
|
||||
官方 `yingce.payment/v1` 支付插件。兼容常见易支付网关:V1/MD5 `mapi.php` 与 V2/RSA `/api/pay/create`,支持支付宝/微信/QQ 等通道。协议实现参考 [acg-faka](https://github.com/lizhipay/acg-faka)。
|
||||
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="易支付">
|
||||
<rect width="64" height="64" rx="14" fill="#1677ff"/>
|
||||
<path fill="#fff" d="M19 17h26v7H27v7h15v7H27v9h-8V17Zm22 0h6v30h-6V17Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 235 B |
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,152 @@
|
||||
## yingce.payment/v1
|
||||
|
||||
支持 `validate_config`、`create_order`、`query_order`、`close_order`、`verify_notification` 和 `download_trade_bill`,统一返回 JSON 响应。
|
||||
|
||||
易支付渠道协议全部封装在本插件内:V1 下单 `POST /mapi.php`(MD5),查单 `GET /api.php?act=order`;V2 下单 `POST /api/pay/create`(RSA,`method=jump`),异步通知为 form/JSON,成功应答 `success`。配置字段包括 `publicBaseUrl`、`pid`、`key`、`gateway`、`payType`、`version`、`checkoutMode`、`privateKey`、`platformPublicKey`。V2 无查单和交易账单下载:关单只关本地订单,对账账单返回 not found。
|
||||
|
||||
<!-- YINGCE_MANIFEST_CONTRACT_START -->
|
||||
## Manifest 完整接口定义
|
||||
|
||||
以下 JSON 与插件包内实际 `manifest.json` 逐字段一致,覆盖插件身份、权限、配置、鉴权、参数、校验、创建、Agent、查询、取消、结果下载、响应和 Agent 响应映射。`documentation` 字段的值就是当前完整文档;为避免文档在自身内部无限递归,JSON 中仅用等义占位文本表示正文。
|
||||
|
||||
```json
|
||||
{
|
||||
"apiVersion": "yingce.plugin/v1",
|
||||
"id": "official-payment-epay",
|
||||
"name": "易支付",
|
||||
"version": "1.0.8",
|
||||
"author": "Epay",
|
||||
"description": "易支付适配器,支持 V1/MD5 与 V2/RSA 的支付宝/微信/QQ 通道。",
|
||||
"enabled": true,
|
||||
"installable": true,
|
||||
"runtime": {
|
||||
"backend": "rpc",
|
||||
"backendEntry": "backend/provider"
|
||||
},
|
||||
"surfaces": [
|
||||
"wallet",
|
||||
"settings"
|
||||
],
|
||||
"permissions": [
|
||||
"payment.create",
|
||||
"payment.query",
|
||||
"payment.close",
|
||||
"payment.reconcile"
|
||||
],
|
||||
"configuration": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "publicBaseUrl",
|
||||
"type": "url",
|
||||
"label": "服务器公网地址",
|
||||
"required": true,
|
||||
"description": "用于确认回调可达;实际 notify_url 由宿主订单生成。"
|
||||
},
|
||||
{
|
||||
"name": "pid",
|
||||
"type": "string",
|
||||
"label": "商户号 (pid)",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "key",
|
||||
"type": "password",
|
||||
"label": "商户密钥 (key)",
|
||||
"required": false,
|
||||
"secret": true,
|
||||
"description": "V1/MD5 密钥;version=1 可留空。"
|
||||
},
|
||||
{
|
||||
"name": "gateway",
|
||||
"type": "url",
|
||||
"label": "支付网关",
|
||||
"required": true,
|
||||
"default": "https://pay.admincloudai.com",
|
||||
"description": "易支付根地址,不要带 /mapi.php。"
|
||||
},
|
||||
{
|
||||
"name": "payType",
|
||||
"type": "string",
|
||||
"label": "默认支付方式",
|
||||
"required": false,
|
||||
"default": "alipay",
|
||||
"values": [
|
||||
"alipay",
|
||||
"wxpay",
|
||||
"qqpay",
|
||||
"usdt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"type": "string",
|
||||
"label": "接口版本",
|
||||
"required": false,
|
||||
"default": "0",
|
||||
"values": [
|
||||
"0",
|
||||
"1"
|
||||
],
|
||||
"description": "0=V1/MD5,1=V2/RSA。"
|
||||
},
|
||||
{
|
||||
"name": "checkoutMode",
|
||||
"type": "string",
|
||||
"label": "收银方式",
|
||||
"required": false,
|
||||
"default": "redirect",
|
||||
"values": [
|
||||
"redirect",
|
||||
"qr_code"
|
||||
],
|
||||
"description": "redirect 跳转;qr_code 展示二维码载荷。"
|
||||
},
|
||||
{
|
||||
"name": "privateKey",
|
||||
"type": "textarea",
|
||||
"label": "V2 商户私钥",
|
||||
"required": false,
|
||||
"secret": true,
|
||||
"description": "仅 version=1,PEM 或裸 Base64。"
|
||||
},
|
||||
{
|
||||
"name": "platformPublicKey",
|
||||
"type": "textarea",
|
||||
"label": "V2 平台公钥",
|
||||
"required": false,
|
||||
"description": "仅 version=1,PEM 或裸 Base64。"
|
||||
}
|
||||
]
|
||||
},
|
||||
"contributes": {
|
||||
"paymentProviders": [
|
||||
{
|
||||
"id": "epay",
|
||||
"label": "易支付",
|
||||
"icon": "assets/icon.svg",
|
||||
"checkoutMode": "redirect",
|
||||
"identityFields": [
|
||||
"pid"
|
||||
],
|
||||
"expiryPolicy": {
|
||||
"defaultMinutes": 10,
|
||||
"minMinutes": 5,
|
||||
"maxMinutes": 1440
|
||||
},
|
||||
"notificationSuccess": {
|
||||
"status": 200,
|
||||
"contentType": "text/plain; charset=utf-8",
|
||||
"body": "success"
|
||||
},
|
||||
"notificationFailure": {
|
||||
"status": 400,
|
||||
"contentType": "text/plain; charset=utf-8",
|
||||
"body": "failure"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"documentation": "<当前插件的完整 documentation,由 README.md 与 docs/interface.md 拼接而成;为避免 JSON 递归,此处不重复展开正文。>"
|
||||
}
|
||||
```
|
||||
<!-- YINGCE_MANIFEST_CONTRACT_END -->
|
||||
@@ -0,0 +1,138 @@
|
||||
{
|
||||
"apiVersion": "yingce.plugin/v1",
|
||||
"id": "official-payment-epay",
|
||||
"name": "易支付",
|
||||
"version": "1.0.8",
|
||||
"author": "Epay",
|
||||
"description": "易支付适配器,支持 V1/MD5 与 V2/RSA 的支付宝/微信/QQ 通道。",
|
||||
"enabled": true,
|
||||
"installable": true,
|
||||
"runtime": {
|
||||
"backend": "rpc",
|
||||
"backendEntry": "backend/provider"
|
||||
},
|
||||
"surfaces": [
|
||||
"wallet",
|
||||
"settings"
|
||||
],
|
||||
"permissions": [
|
||||
"payment.create",
|
||||
"payment.query",
|
||||
"payment.close",
|
||||
"payment.reconcile"
|
||||
],
|
||||
"configuration": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "publicBaseUrl",
|
||||
"type": "url",
|
||||
"label": "服务器公网地址",
|
||||
"required": true,
|
||||
"description": "用于确认回调可达;实际 notify_url 由宿主订单生成。"
|
||||
},
|
||||
{
|
||||
"name": "pid",
|
||||
"type": "string",
|
||||
"label": "商户号 (pid)",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "key",
|
||||
"type": "password",
|
||||
"label": "商户密钥 (key)",
|
||||
"required": false,
|
||||
"secret": true,
|
||||
"description": "V1/MD5 密钥;version=1 可留空。"
|
||||
},
|
||||
{
|
||||
"name": "gateway",
|
||||
"type": "url",
|
||||
"label": "支付网关",
|
||||
"required": true,
|
||||
"default": "https://pay.admincloudai.com",
|
||||
"description": "易支付根地址,不要带 /mapi.php。"
|
||||
},
|
||||
{
|
||||
"name": "payType",
|
||||
"type": "string",
|
||||
"label": "默认支付方式",
|
||||
"required": false,
|
||||
"default": "alipay",
|
||||
"values": [
|
||||
"alipay",
|
||||
"wxpay",
|
||||
"qqpay",
|
||||
"usdt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"type": "string",
|
||||
"label": "接口版本",
|
||||
"required": false,
|
||||
"default": "0",
|
||||
"values": [
|
||||
"0",
|
||||
"1"
|
||||
],
|
||||
"description": "0=V1/MD5,1=V2/RSA。"
|
||||
},
|
||||
{
|
||||
"name": "checkoutMode",
|
||||
"type": "string",
|
||||
"label": "收银方式",
|
||||
"required": false,
|
||||
"default": "redirect",
|
||||
"values": [
|
||||
"redirect",
|
||||
"qr_code"
|
||||
],
|
||||
"description": "redirect 跳转;qr_code 展示二维码载荷。"
|
||||
},
|
||||
{
|
||||
"name": "privateKey",
|
||||
"type": "textarea",
|
||||
"label": "V2 商户私钥",
|
||||
"required": false,
|
||||
"secret": true,
|
||||
"description": "仅 version=1,PEM 或裸 Base64。"
|
||||
},
|
||||
{
|
||||
"name": "platformPublicKey",
|
||||
"type": "textarea",
|
||||
"label": "V2 平台公钥",
|
||||
"required": false,
|
||||
"description": "仅 version=1,PEM 或裸 Base64。"
|
||||
}
|
||||
]
|
||||
},
|
||||
"contributes": {
|
||||
"paymentProviders": [
|
||||
{
|
||||
"id": "epay",
|
||||
"label": "易支付",
|
||||
"icon": "assets/icon.svg",
|
||||
"checkoutMode": "redirect",
|
||||
"identityFields": [
|
||||
"pid"
|
||||
],
|
||||
"expiryPolicy": {
|
||||
"defaultMinutes": 10,
|
||||
"minMinutes": 5,
|
||||
"maxMinutes": 1440
|
||||
},
|
||||
"notificationSuccess": {
|
||||
"status": 200,
|
||||
"contentType": "text/plain; charset=utf-8",
|
||||
"body": "success"
|
||||
},
|
||||
"notificationFailure": {
|
||||
"status": 400,
|
||||
"contentType": "text/plain; charset=utf-8",
|
||||
"body": "failure"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"documentation": "# 易支付\n\n官方 `yingce.payment/v1` 支付插件。兼容常见易支付网关:V1/MD5 `mapi.php` 与 V2/RSA `/api/pay/create`,支持支付宝/微信/QQ 等通道。协议实现参考 [acg-faka](https://github.com/lizhipay/acg-faka)。\n\n---\n\n## yingce.payment/v1\n\n支持 `validate_config`、`create_order`、`query_order`、`close_order`、`verify_notification` 和 `download_trade_bill`,统一返回 JSON 响应。\n\n易支付渠道协议全部封装在本插件内:V1 下单 `POST /mapi.php`(MD5),查单 `GET /api.php?act=order`;V2 下单 `POST /api/pay/create`(RSA,`method=jump`),异步通知为 form/JSON,成功应答 `success`。配置字段包括 `publicBaseUrl`、`pid`、`key`、`gateway`、`payType`、`version`、`checkoutMode`、`privateKey`、`platformPublicKey`。V2 无查单和交易账单下载:关单只关本地订单,对账账单返回 not found。\n\n<!-- YINGCE_MANIFEST_CONTRACT_START -->\n## Manifest 完整接口定义\n\n以下 JSON 与插件包内实际 `manifest.json` 逐字段一致,覆盖插件身份、权限、配置、鉴权、参数、校验、创建、Agent、查询、取消、结果下载、响应和 Agent 响应映射。`documentation` 字段的值就是当前完整文档;为避免文档在自身内部无限递归,JSON 中仅用等义占位文本表示正文。\n\n```json\n{\n \"apiVersion\": \"yingce.plugin/v1\",\n \"id\": \"official-payment-epay\",\n \"name\": \"易支付\",\n \"version\": \"1.0.8\",\n \"author\": \"Epay\",\n \"description\": \"易支付适配器,支持 V1/MD5 与 V2/RSA 的支付宝/微信/QQ 通道。\",\n \"enabled\": true,\n \"installable\": true,\n \"runtime\": {\n \"backend\": \"rpc\",\n \"backendEntry\": \"backend/provider\"\n },\n \"surfaces\": [\n \"wallet\",\n \"settings\"\n ],\n \"permissions\": [\n \"payment.create\",\n \"payment.query\",\n \"payment.close\",\n \"payment.reconcile\"\n ],\n \"configuration\": {\n \"fields\": [\n {\n \"name\": \"publicBaseUrl\",\n \"type\": \"url\",\n \"label\": \"服务器公网地址\",\n \"required\": true,\n \"description\": \"用于确认回调可达;实际 notify_url 由宿主订单生成。\"\n },\n {\n \"name\": \"pid\",\n \"type\": \"string\",\n \"label\": \"商户号 (pid)\",\n \"required\": true\n },\n {\n \"name\": \"key\",\n \"type\": \"password\",\n \"label\": \"商户密钥 (key)\",\n \"required\": false,\n \"secret\": true,\n \"description\": \"V1/MD5 密钥;version=1 可留空。\"\n },\n {\n \"name\": \"gateway\",\n \"type\": \"url\",\n \"label\": \"支付网关\",\n \"required\": true,\n \"default\": \"https://pay.admincloudai.com\",\n \"description\": \"易支付根地址,不要带 /mapi.php。\"\n },\n {\n \"name\": \"payType\",\n \"type\": \"string\",\n \"label\": \"默认支付方式\",\n \"required\": false,\n \"default\": \"alipay\",\n \"values\": [\n \"alipay\",\n \"wxpay\",\n \"qqpay\",\n \"usdt\"\n ]\n },\n {\n \"name\": \"version\",\n \"type\": \"string\",\n \"label\": \"接口版本\",\n \"required\": false,\n \"default\": \"0\",\n \"values\": [\n \"0\",\n \"1\"\n ],\n \"description\": \"0=V1/MD5,1=V2/RSA。\"\n },\n {\n \"name\": \"checkoutMode\",\n \"type\": \"string\",\n \"label\": \"收银方式\",\n \"required\": false,\n \"default\": \"redirect\",\n \"values\": [\n \"redirect\",\n \"qr_code\"\n ],\n \"description\": \"redirect 跳转;qr_code 展示二维码载荷。\"\n },\n {\n \"name\": \"privateKey\",\n \"type\": \"textarea\",\n \"label\": \"V2 商户私钥\",\n \"required\": false,\n \"secret\": true,\n \"description\": \"仅 version=1,PEM 或裸 Base64。\"\n },\n {\n \"name\": \"platformPublicKey\",\n \"type\": \"textarea\",\n \"label\": \"V2 平台公钥\",\n \"required\": false,\n \"description\": \"仅 version=1,PEM 或裸 Base64。\"\n }\n ]\n },\n \"contributes\": {\n \"paymentProviders\": [\n {\n \"id\": \"epay\",\n \"label\": \"易支付\",\n \"icon\": \"assets/icon.svg\",\n \"checkoutMode\": \"redirect\",\n \"identityFields\": [\n \"pid\"\n ],\n \"expiryPolicy\": {\n \"defaultMinutes\": 10,\n \"minMinutes\": 5,\n \"maxMinutes\": 1440\n },\n \"notificationSuccess\": {\n \"status\": 200,\n \"contentType\": \"text/plain; charset=utf-8\",\n \"body\": \"success\"\n },\n Line truncated
|
||||
}
|
||||
@@ -118,7 +118,7 @@ if [ "$require_all" = true ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
for package_id in official-payment-wechat-native official-payment-alipay-page official-payment-xunhupay official-payment-zhifufm; do
|
||||
for package_id in official-payment-wechat-native official-payment-alipay-page official-payment-xunhupay official-payment-zhifufm official-payment-epay; do
|
||||
backend_dir="$root_dir/$package_id/backend"
|
||||
provider="$backend_dir/provider"
|
||||
package_file="$root_dir/$package_id.yingce-plugin"
|
||||
|
||||
Reference in new issue
Block a user