UNPKG

koishi-plugin-pay-tool

Version:

适用于Koishi框架的易支付工具插件,支持订单创建、查询、退款、分配等功能

82 lines (81 loc) 3.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.schema = void 0; const koishi_1 = require("koishi"); exports.schema = koishi_1.Schema.intersect([ koishi_1.Schema.intersect([ koishi_1.Schema.object({ adminQQ: koishi_1.Schema.string() .description('管理员QQ号') .pattern(/^\d{5,12}$/) .required(), callbackRoute: koishi_1.Schema.string() .description('回调路由') .pattern(/^\/.*\/$/) .default('/paytool/callback/'), devMode: koishi_1.Schema.boolean() .description('调试模式(启用详细日志输出)') .default(false), activeQueryEnabled: koishi_1.Schema.boolean() .description('主动查询模式(用于无法接收回调通知的环境)') .default(false), }), koishi_1.Schema.union([ koishi_1.Schema.object({ activeQueryEnabled: koishi_1.Schema.const(true).required(), initialWaitTime: koishi_1.Schema.number() .description('等待时长(毫秒)- 首次查询新订单需要等待的时间') .min(5000) .max(300000) .default(30000), pollingInterval: koishi_1.Schema.number() .description('轮询间隔(毫秒)- 每次查询订单后的等待时间') .min(5000) .max(300000) .default(30000), orderExpirationTime: koishi_1.Schema.number() .description('订单过期时间(分钟)- 超过此时间将停止主动查询') .min(5) .max(180) .default(30), }), koishi_1.Schema.object({}), ]) ]), koishi_1.Schema.object({ apiUrl: koishi_1.Schema.string() .description('易支付接口地址') .role('link') .required(), merchantPid: koishi_1.Schema.string() .description('商户PID') .pattern(/^[a-zA-Z0-9]+$/) .required(), merchantKey: koishi_1.Schema.string() .description('商户密钥') .role('secret') .required(), productName: koishi_1.Schema.string() .description('商品名称(显示在订单中)') .default('金币'), paymentMethods: koishi_1.Schema .dict(String) .description('支付方式配置(键为支付方式代码,值为显示名称)') .default({ alipay: '支付宝', wxpay: '微信支付' }), defaultPayment: koishi_1.Schema .string() .description('默认支付方式(请确保该代码存在于上面的支付方式配置中)') .default('wxpay'), notifyUrl: koishi_1.Schema.string() .description('回调通知地址(配置到易支付后台)') .role('link') .default('https://koishi.local/paytool/callback/'), returnUrl: koishi_1.Schema.string() .description('跳转地址(可选,交易完成后浏览器跳转地址)') .role('link') .default(''), }).description('商户配置'), ]);