Files
123perfect321 114e9efee4 feat: implement epay gateway integration
Payment flow:
- admin Settings → 支付配置: add epay_pid / epay_key / epay_gateway fields,
  with a "测试网关连通" button that hits the gateway's submit.php
- backend: new utils/epay.ts with MD5 sign/verify (timing-safe) and
  gateway URL builder
- backend: rewrite payment.service to read config from Setting table,
  call fulfillOrderByToken on callback
- backend: new GET/POST /api/payments/notify (plain "success"/"fail")
  and GET /api/payments/return (redirect to /success/:token)
- backend: notify/return routes are unauthenticated
- order.service: extract fulfillOrderByToken(token, tradeNo) helper
  used by both simulatePayment and real callbacks
- frontend Pay.vue: auto-create payment on mount and redirect to gateway;
  polling order status every 4s; keep "模拟支付" for local testing
- admin: display the two callback URLs computed from SITE_URL so the
  operator knows what to fill on the epay dashboard
- .env.example: add SITE_URL documentation

README: add 配置支付(易支付)section.
2026-06-17 15:38:51 +08:00

41 lines
1.1 KiB
JSON

{
"name": "autocard-backend",
"version": "1.0.0",
"description": "星云发卡平台后端 API",
"main": "dist/index.js",
"scripts": {
"dev": "ts-node-dev --respawn --transpile-only src/index.ts",
"build": "tsc",
"start": "node dist/index.js",
"prisma:generate": "prisma generate",
"prisma:migrate": "prisma migrate dev",
"prisma:seed": "ts-node prisma/seed.ts"
},
"dependencies": {
"@prisma/client": "^5.22.0",
"bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.21.1",
"express-rate-limit": "^7.4.1",
"helmet": "^8.0.0",
"jsonwebtoken": "^9.0.2",
"multer": "^2.2.0",
"nodemailer": "^6.9.16",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/bcryptjs": "^2.4.6",
"@types/cors": "^2.8.17",
"@types/express": "^5.0.0",
"@types/jsonwebtoken": "^9.0.7",
"@types/multer": "^2.1.0",
"@types/node": "^22.9.0",
"@types/nodemailer": "^6.4.16",
"prisma": "^5.22.0",
"ts-node": "^10.9.2",
"ts-node-dev": "^2.0.0",
"typescript": "^5.6.3"
}
}