{"_id":"@cofferstech/easy-recon-sdk","name":"@cofferstech/easy-recon-sdk","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@cofferstech/easy-recon-sdk","version":"1.0.0","description":"多商户支付对账SDK - Node.js版本","main":"index.js","repository":{"type":"git","url":"git+https://github.com/coffersTech/easy-recon.git","directory":"sdk/node.js"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"echo \"Building Node.js SDK...\""},"keywords":["reconciliation","payment","sdk","nodejs","easy-recon"],"author":{"name":"Ryan"},"license":"MIT","dependencies":{"cron":"^2.4.0","decimal.js":"^10.6.0","mysql2":"^3.6.5","pg":"^8.11.3"},"gitHead":"c2ce941fafc2e1355aba3d14d9d7ec0f000d9f3b","bugs":{"url":"https://github.com/coffersTech/easy-recon/issues"},"homepage":"https://github.com/coffersTech/easy-recon#readme","_id":"@cofferstech/easy-recon-sdk@1.0.0","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-cVrNDc5M+Ao4nc3XAP1UEl24sOnIR5hFum8rgO7cpsMB9UsmfoMoSMq/lfzZ1k61X9LuFYAwQ3HcLoBeqbXdGQ==","shasum":"65b01ee321c35fabefd74b3de08be2cadf22fa76","tarball":"https://registry.npmjs.org/@cofferstech/easy-recon-sdk/-/easy-recon-sdk-1.0.0.tgz","fileCount":19,"unpackedSize":49416,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDXAV6WKiECMdTmUoXj15aDla0oLSOKXEDxRSnDGx2D1wIhAPH3B81WD0zTfzX04Cki1kYMwOfAoeB4qSbtq8SkkALQ"}]},"_npmUser":{"name":"cofferstech","email":"ruifafan@gmail.com"},"directories":{},"maintainers":[{"name":"cofferstech","email":"ruifafan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/easy-recon-sdk_1.0.0_1771331361014_0.0018862397492187544"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-17T12:29:20.924Z","1.0.0":"2026-02-17T12:29:21.181Z","modified":"2026-02-17T12:29:21.377Z"},"maintainers":[{"name":"cofferstech","email":"ruifafan@gmail.com"}],"description":"多商户支付对账SDK - Node.js版本","homepage":"https://github.com/coffersTech/easy-recon#readme","keywords":["reconciliation","payment","sdk","nodejs","easy-recon"],"repository":{"type":"git","url":"git+https://github.com/coffersTech/easy-recon.git","directory":"sdk/node.js"},"author":{"name":"Ryan"},"bugs":{"url":"https://github.com/coffersTech/easy-recon/issues"},"license":"MIT","readme":"# Easy Recon SDK for Node.js\n\n多商户支付对账 SDK Node.js 版本，提供统一的标准接口，支持 MySQL 和 PostgreSQL 数据库。\n\n## 特性\n\n*   **多数据库支持**: 内置 MySQL 和 PostgreSQL 方言。\n*   **全场景覆盖**: 支持实时对账、退款对账、异步通知回调、定时全量核账。\n*   **易于集成**: 零配置即可运行，提供开箱即用的 API Facade。\n*   **告警机制**: 集成钉钉告警和日志告警。\n\n## 安装\n\n```bash\nnpm install @cofferstech/easy-recon-sdk\n```\n\n## 快速开始\n\n### 1. 初始化\n\n```javascript\nconst { EasyReconApi } = require('@cofferstech/easy-recon-sdk');\nconst mysql = require('mysql2/promise'); // 或 require('pg');\n\n// 数据库连接 (以 mysql2 为例)\nconst connection = await mysql.createConnection({\n  host: 'localhost',\n  user: 'root',\n  password: 'password',\n  database: 'easy_recon_demo'\n});\n\n// 配置\nconst config = {\n  enabled: true,\n  amountTolerance: '0.01',\n  alarm: {\n    type: 'dingtalk',\n    dingtalk: {\n      webhookUrl: 'https://oapi.dingtalk.com/robot/send?access_token=YOUR_TOKEN'\n    }\n  }\n};\n\n// 实例化 SDK\nconst sdk = new EasyReconApi(config, connection);\n\n// 初始化表结构 (可选)\nconst ddl = sdk.getCreateTableSQL();\nfor (const sql of ddl) {\n  await connection.execute(sql);\n}\n```\n\n### 2. 实时对账\n\n```javascript\nconst { ReconOrderMain, ReconOrderSplitSub } = require('@cofferstech/easy-recon-sdk');\n\n// 构造主订单\nconst main = new ReconOrderMain();\nmain.orderNo = 'ORD001';\nmain.merchantId = 'MCH001';\nmain.orderAmount = '100.00';\nmain.payAmount = '100.00';\nmain.payStatus = 1; // SUCCESS\n// ... 其他字段\n\n// 构造分账详情\nconst sub = new ReconOrderSplitSub();\nsub.subOrderNo = 'SUB001';\nsub.splitAmount = '100.00';\n\n// 执行对账\nawait sdk.reconOrder(main, [sub]);\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-24de30f330d0a5d3ddd32d202622c7a3"}