@plolink/sdk 0.0.4

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.
Files changed (76) hide show
  1. package/README.md +259 -0
  2. package/dist/chunk-4H4RACSE.js +335 -0
  3. package/dist/chunk-4H4RACSE.js.map +1 -0
  4. package/dist/chunk-IHAAKFEJ.js +219 -0
  5. package/dist/chunk-IHAAKFEJ.js.map +1 -0
  6. package/dist/chunk-JR4HYYQI.cjs +221 -0
  7. package/dist/chunk-JR4HYYQI.cjs.map +1 -0
  8. package/dist/chunk-MD4O7FWT.js +46 -0
  9. package/dist/chunk-MD4O7FWT.js.map +1 -0
  10. package/dist/chunk-NS3DJP2O.cjs +349 -0
  11. package/dist/chunk-NS3DJP2O.cjs.map +1 -0
  12. package/dist/chunk-Y3UJVC2L.cjs +48 -0
  13. package/dist/chunk-Y3UJVC2L.cjs.map +1 -0
  14. package/dist/client-CAjIQKPm.d.cts +193 -0
  15. package/dist/client-CwNikk7i.d.ts +193 -0
  16. package/dist/common/index.cjs +65 -0
  17. package/dist/common/index.cjs.map +1 -0
  18. package/dist/common/index.d.cts +422 -0
  19. package/dist/common/index.d.ts +422 -0
  20. package/dist/common/index.js +4 -0
  21. package/dist/common/index.js.map +1 -0
  22. package/dist/core-77EbLgbp.d.cts +97 -0
  23. package/dist/core-77EbLgbp.d.ts +97 -0
  24. package/dist/index.cjs +350 -0
  25. package/dist/index.cjs.map +1 -0
  26. package/dist/index.d.cts +98 -0
  27. package/dist/index.d.ts +98 -0
  28. package/dist/index.js +306 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/modules/agent/index.cjs +21 -0
  31. package/dist/modules/agent/index.cjs.map +1 -0
  32. package/dist/modules/agent/index.d.cts +71 -0
  33. package/dist/modules/agent/index.d.ts +71 -0
  34. package/dist/modules/agent/index.js +19 -0
  35. package/dist/modules/agent/index.js.map +1 -0
  36. package/dist/modules/billing/index.cjs +413 -0
  37. package/dist/modules/billing/index.cjs.map +1 -0
  38. package/dist/modules/billing/index.d.cts +538 -0
  39. package/dist/modules/billing/index.d.ts +538 -0
  40. package/dist/modules/billing/index.js +411 -0
  41. package/dist/modules/billing/index.js.map +1 -0
  42. package/dist/modules/chat/index.cjs +20 -0
  43. package/dist/modules/chat/index.cjs.map +1 -0
  44. package/dist/modules/chat/index.d.cts +68 -0
  45. package/dist/modules/chat/index.d.ts +68 -0
  46. package/dist/modules/chat/index.js +18 -0
  47. package/dist/modules/chat/index.js.map +1 -0
  48. package/dist/modules/psych/index.cjs +20 -0
  49. package/dist/modules/psych/index.cjs.map +1 -0
  50. package/dist/modules/psych/index.d.cts +69 -0
  51. package/dist/modules/psych/index.d.ts +69 -0
  52. package/dist/modules/psych/index.js +18 -0
  53. package/dist/modules/psych/index.js.map +1 -0
  54. package/dist/modules/rbac/index.cjs +197 -0
  55. package/dist/modules/rbac/index.cjs.map +1 -0
  56. package/dist/modules/rbac/index.d.cts +293 -0
  57. package/dist/modules/rbac/index.d.ts +293 -0
  58. package/dist/modules/rbac/index.js +195 -0
  59. package/dist/modules/rbac/index.js.map +1 -0
  60. package/dist/modules/team/index.cjs +54 -0
  61. package/dist/modules/team/index.cjs.map +1 -0
  62. package/dist/modules/team/index.d.cts +91 -0
  63. package/dist/modules/team/index.d.ts +91 -0
  64. package/dist/modules/team/index.js +52 -0
  65. package/dist/modules/team/index.js.map +1 -0
  66. package/dist/modules/virtual-account/index.cjs +293 -0
  67. package/dist/modules/virtual-account/index.cjs.map +1 -0
  68. package/dist/modules/virtual-account/index.d.cts +366 -0
  69. package/dist/modules/virtual-account/index.d.ts +366 -0
  70. package/dist/modules/virtual-account/index.js +291 -0
  71. package/dist/modules/virtual-account/index.js.map +1 -0
  72. package/dist/poller-BlIRbwL4.d.cts +201 -0
  73. package/dist/poller-DWKZjuSw.d.ts +201 -0
  74. package/dist/shared-6ZepUSPW.d.cts +31 -0
  75. package/dist/shared-6ZepUSPW.d.ts +31 -0
  76. package/package.json +96 -0
@@ -0,0 +1,413 @@
1
+ 'use strict';
2
+
3
+ var chunkJR4HYYQI_cjs = require('../../chunk-JR4HYYQI.cjs');
4
+ var chunkY3UJVC2L_cjs = require('../../chunk-Y3UJVC2L.cjs');
5
+
6
+ // src/modules/billing/index.ts
7
+ var Billing = class {
8
+ constructor(client) {
9
+ this.client = client;
10
+ }
11
+ /**
12
+ * 获取团队余额信息
13
+ *
14
+ * @returns 余额信息,包括可用余额和可开票金额
15
+ * @throws {PlolinkError} 当请求失败时抛出
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const balance = await billing.getBalance();
20
+ * console.log(`余额: ${balance.balance}, 可开票: ${balance.invoiceableAmount}`);
21
+ * ```
22
+ */
23
+ async getBalance() {
24
+ return this.client.axiosInstance.get("/api/v1/payments/balance");
25
+ }
26
+ /**
27
+ * 创建微信充值订单
28
+ *
29
+ * @param params - 充值参数
30
+ * @returns 充值订单信息,包含二维码URL和订单号
31
+ * @throws {PlolinkError} 当金额无效或创建失败时抛出
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * // 基础充值(仅返回二维码URL)
36
+ * const result = await billing.createRecharge({
37
+ * amount: 100,
38
+ * description: '充值100元'
39
+ * });
40
+ * console.log(`请使用微信扫描: ${result.qrCodeUrl}`);
41
+ *
42
+ * // 充值并获取二维码图片
43
+ * const result = await billing.createRecharge({
44
+ * amount: 100,
45
+ * needQrCodeImage: true
46
+ * });
47
+ * console.log(`二维码图片地址: ${result.qrCodeImageUrl}`);
48
+ * ```
49
+ */
50
+ async createRecharge(params) {
51
+ const { amount, description, needQrCodeImage } = params;
52
+ if (amount <= 0) {
53
+ throw new chunkY3UJVC2L_cjs.PlolinkError("Amount must be greater than 0", "INVALID_AMOUNT");
54
+ }
55
+ return this.client.axiosInstance.post("/api/v1/payments/recharge/wechat", {
56
+ amount,
57
+ description,
58
+ needQrCodeImage
59
+ });
60
+ }
61
+ /**
62
+ * 查询订单状态
63
+ *
64
+ * @param orderNo - 订单号
65
+ * @returns 订单状态信息
66
+ * @throws {PlolinkError} 当订单不存在时抛出
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * const status = await billing.getOrderStatus('ORDER_123');
71
+ * console.log(`订单状态: ${status.status}`);
72
+ * ```
73
+ */
74
+ async getOrderStatus(orderNo) {
75
+ const records = await this.getRechargeRecords();
76
+ const record = records.find((r) => r.orderId === orderNo);
77
+ if (!record) {
78
+ throw new chunkY3UJVC2L_cjs.PlolinkError(`Order not found: ${orderNo}`, "ORDER_NOT_FOUND");
79
+ }
80
+ return {
81
+ orderNo,
82
+ status: record.status,
83
+ amount: record.amount,
84
+ createdAt: record.createdAt
85
+ };
86
+ }
87
+ /**
88
+ * 轮询订单状态
89
+ *
90
+ * @description
91
+ * 创建一个轮询器持续监听订单状态变化,直到订单达到终态(success/failed/closed)。
92
+ * 使用指数退避策略,初始间隔1秒,最大间隔30秒。
93
+ *
94
+ * @param orderNo - 订单号
95
+ * @param onStatusChange - 状态变化回调函数
96
+ * @returns Poller实例,可用于手动停止轮询
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * const poller = billing.watchOrderStatus('ORDER_123', (status) => {
101
+ * console.log(`状态更新: ${status.status}`);
102
+ *
103
+ * if (status.status === 'success') {
104
+ * console.log('支付成功!');
105
+ * } else if (status.status === 'failed') {
106
+ * console.error('支付失败!');
107
+ * }
108
+ * });
109
+ *
110
+ * // 开始轮询
111
+ * poller.start();
112
+ *
113
+ * // 需要时可以手动停止
114
+ * // poller.stop();
115
+ * ```
116
+ */
117
+ watchOrderStatus(orderNo, onStatusChange) {
118
+ const poller = new chunkJR4HYYQI_cjs.Poller({
119
+ task: () => this.getOrderStatus(orderNo),
120
+ onResult: onStatusChange,
121
+ shouldStop: (status) => {
122
+ return ["success", "failed", "closed"].includes(status.status);
123
+ },
124
+ initialInterval: 1e3,
125
+ maxInterval: 3e4,
126
+ backoffFactor: 1.5,
127
+ onError: (error) => {
128
+ this.client.logger.error("Order polling error", { error, orderNo });
129
+ }
130
+ });
131
+ void poller.start();
132
+ return poller;
133
+ }
134
+ /**
135
+ * 获取消耗统计
136
+ *
137
+ * @returns 消耗统计信息(今日/7天/30天)
138
+ * @throws {PlolinkError} 当请求失败时抛出
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * const stats = await billing.getConsumptionStats();
143
+ * console.log(`今日消耗: ${stats.today}`);
144
+ * console.log(`7天消耗: ${stats.last7Days}`);
145
+ * console.log(`30天消耗: ${stats.last30Days}`);
146
+ * ```
147
+ */
148
+ async getConsumptionStats() {
149
+ return this.client.axiosInstance.get("/api/v1/payments/consumption/stats");
150
+ }
151
+ /**
152
+ * 获取消费记录(分页)
153
+ *
154
+ * @param params - 分页参数
155
+ * @returns 消费记录列表和总数
156
+ * @throws {PlolinkError} 当请求失败时抛出
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * const result = await billing.getConsumptionRecords({
161
+ * page: 1,
162
+ * pageSize: 20
163
+ * });
164
+ * console.log(`共 ${result.total} 条记录`);
165
+ * result.list.forEach(record => {
166
+ * console.log(`消费: ${record.amount}, 用途: ${record.purpose}`);
167
+ * });
168
+ * ```
169
+ */
170
+ async getConsumptionRecords(params = {}) {
171
+ const { page = 1, pageSize = 20 } = params;
172
+ return this.client.axiosInstance.get("/api/v1/payments/consumption/records", {
173
+ params: { page, pageSize }
174
+ });
175
+ }
176
+ /**
177
+ * 获取充值记录
178
+ *
179
+ * @returns 充值记录列表
180
+ * @throws {PlolinkError} 当请求失败时抛出
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * const records = await billing.getRechargeRecords();
185
+ * records.forEach(record => {
186
+ * console.log(`${record.createdAt}: ${record.amount}, 状态: ${record.status}`);
187
+ * });
188
+ * ```
189
+ */
190
+ async getRechargeRecords() {
191
+ return this.client.axiosInstance.get("/api/v1/payments/recharge/records");
192
+ }
193
+ /**
194
+ * 获取开票记录
195
+ *
196
+ * @returns 开票记录列表
197
+ * @throws {PlolinkError} 当请求失败时抛出
198
+ *
199
+ * @example
200
+ * ```typescript
201
+ * const records = await billing.getInvoiceRecords();
202
+ * records.forEach(record => {
203
+ * console.log(`发票: ${record.invoiceNumber}, 金额: ${record.amount}`);
204
+ * });
205
+ * ```
206
+ */
207
+ async getInvoiceRecords() {
208
+ return this.client.axiosInstance.get("/api/v1/payments/invoice/records");
209
+ }
210
+ /**
211
+ * 获取退费记录
212
+ *
213
+ * @returns 退费记录列表
214
+ * @throws {PlolinkError} 当请求失败时抛出
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * const records = await billing.getRefundRecords();
219
+ * records.forEach(record => {
220
+ * console.log(`退费: ${record.amount}, 备注: ${record.remark}`);
221
+ * });
222
+ * ```
223
+ */
224
+ async getRefundRecords() {
225
+ return this.client.axiosInstance.get("/api/v1/payments/refund/records");
226
+ }
227
+ /**
228
+ * 获取对公账户信息
229
+ *
230
+ * @returns 对公账户信息
231
+ * @throws {PlolinkError} 当请求失败时抛出
232
+ *
233
+ * @example
234
+ * ```typescript
235
+ * const account = await billing.getCompanyAccount();
236
+ * console.log(`账户名: ${account.accountName}`);
237
+ * console.log(`账号: ${account.accountNumber}`);
238
+ * console.log(`开户行: ${account.bankName}`);
239
+ * ```
240
+ */
241
+ async getCompanyAccount() {
242
+ return this.client.axiosInstance.get("/api/v1/payments/company-account");
243
+ }
244
+ // ============ 跨团队查询接口 ============
245
+ /**
246
+ * 获取跨团队开票记录
247
+ *
248
+ * 用于财务人员在多个团队中拥有财务权限时查询所有可管理团队的开票记录
249
+ *
250
+ * @param params - 查询参数
251
+ * @returns 分页结果(包含团队名称)
252
+ * @throws {PlolinkError} 当参数无效或请求失败时抛出
253
+ *
254
+ * @example
255
+ * ```typescript
256
+ * const result = await billing.getInvoiceRecordsCrossTeam({
257
+ * startDate: '2025-01-01T00:00:00.000Z',
258
+ * endDate: '2025-01-31T23:59:59.999Z',
259
+ * page: 1,
260
+ * pageSize: 20
261
+ * });
262
+ *
263
+ * console.log(`共查询到 ${result.total} 条记录`);
264
+ * result.list.forEach(record => {
265
+ * console.log(`团队: ${record.teamName}, 发票号: ${record.invoiceNumber}, 金额: ${record.amount}`);
266
+ * });
267
+ * ```
268
+ */
269
+ async getInvoiceRecordsCrossTeam(params) {
270
+ const { startDate, endDate, page = 1, pageSize = 20 } = params;
271
+ if (!startDate || !endDate) {
272
+ throw new chunkY3UJVC2L_cjs.PlolinkError("startDate and endDate are required", "MISSING_PARAMS");
273
+ }
274
+ if (pageSize > 100) {
275
+ throw new chunkY3UJVC2L_cjs.PlolinkError("pageSize must not exceed 100", "INVALID_PAGE_SIZE");
276
+ }
277
+ return this.client.axiosInstance.get("/api/v1/payments/invoice/records:cross-team", {
278
+ params: {
279
+ startDate,
280
+ endDate,
281
+ page,
282
+ pageSize
283
+ }
284
+ });
285
+ }
286
+ /**
287
+ * 获取跨团队充值记录
288
+ *
289
+ * 用于财务人员在多个团队中拥有财务权限时查询所有可管理团队的充值记录
290
+ *
291
+ * @param params - 查询参数
292
+ * @returns 分页结果(包含团队名称)
293
+ * @throws {PlolinkError} 当参数无效或请求失败时抛出
294
+ *
295
+ * @example
296
+ * ```typescript
297
+ * const result = await billing.getRechargeRecordsCrossTeam({
298
+ * startDate: '2025-01-01T00:00:00.000Z',
299
+ * endDate: '2025-01-31T23:59:59.999Z',
300
+ * page: 1,
301
+ * pageSize: 20
302
+ * });
303
+ *
304
+ * console.log(`共查询到 ${result.total} 条记录`);
305
+ * result.list.forEach(record => {
306
+ * console.log(`团队: ${record.teamName}, 金额: ${record.amount}, 状态: ${record.status}`);
307
+ * });
308
+ * ```
309
+ */
310
+ async getRechargeRecordsCrossTeam(params) {
311
+ const { startDate, endDate, page = 1, pageSize = 20 } = params;
312
+ if (!startDate || !endDate) {
313
+ throw new chunkY3UJVC2L_cjs.PlolinkError("startDate and endDate are required", "MISSING_PARAMS");
314
+ }
315
+ if (pageSize > 100) {
316
+ throw new chunkY3UJVC2L_cjs.PlolinkError("pageSize must not exceed 100", "INVALID_PAGE_SIZE");
317
+ }
318
+ return this.client.axiosInstance.get("/api/v1/payments/recharge/records:cross-team", {
319
+ params: {
320
+ startDate,
321
+ endDate,
322
+ page,
323
+ pageSize
324
+ }
325
+ });
326
+ }
327
+ /**
328
+ * 获取跨团队消费记录
329
+ *
330
+ * 用于财务人员在多个团队中拥有财务权限时查询所有可管理团队的消费记录
331
+ *
332
+ * @param params - 查询参数
333
+ * @returns 分页结果(包含团队名称)
334
+ * @throws {PlolinkError} 当参数无效或请求失败时抛出
335
+ *
336
+ * @example
337
+ * ```typescript
338
+ * const result = await billing.getConsumptionRecordsCrossTeam({
339
+ * startDate: '2025-01-01T00:00:00.000Z',
340
+ * endDate: '2025-01-31T23:59:59.999Z',
341
+ * page: 1,
342
+ * pageSize: 20
343
+ * });
344
+ *
345
+ * console.log(`共查询到 ${result.total} 条记录`);
346
+ * result.list.forEach(record => {
347
+ * console.log(`团队: ${record.teamName}, 金额: ${record.amount}, 用途: ${record.purpose}`);
348
+ * });
349
+ * ```
350
+ */
351
+ async getConsumptionRecordsCrossTeam(params) {
352
+ const { startDate, endDate, page = 1, pageSize = 20 } = params;
353
+ if (!startDate || !endDate) {
354
+ throw new chunkY3UJVC2L_cjs.PlolinkError("startDate and endDate are required", "MISSING_PARAMS");
355
+ }
356
+ if (pageSize > 100) {
357
+ throw new chunkY3UJVC2L_cjs.PlolinkError("pageSize must not exceed 100", "INVALID_PAGE_SIZE");
358
+ }
359
+ return this.client.axiosInstance.get("/api/v1/payments/consumption/records:cross-team", {
360
+ params: {
361
+ startDate,
362
+ endDate,
363
+ page,
364
+ pageSize
365
+ }
366
+ });
367
+ }
368
+ /**
369
+ * 获取跨团队退费记录
370
+ *
371
+ * 用于财务人员在多个团队中拥有财务权限时查询所有可管理团队的退费记录
372
+ *
373
+ * @param params - 查询参数
374
+ * @returns 分页结果(包含团队名称)
375
+ * @throws {PlolinkError} 当参数无效或请求失败时抛出
376
+ *
377
+ * @example
378
+ * ```typescript
379
+ * const result = await billing.getRefundRecordsCrossTeam({
380
+ * startDate: '2025-01-01T00:00:00.000Z',
381
+ * endDate: '2025-01-31T23:59:59.999Z',
382
+ * page: 1,
383
+ * pageSize: 20
384
+ * });
385
+ *
386
+ * console.log(`共查询到 ${result.total} 条记录`);
387
+ * result.list.forEach(record => {
388
+ * console.log(`团队: ${record.teamName}, 金额: ${record.amount}, 备注: ${record.remark}`);
389
+ * });
390
+ * ```
391
+ */
392
+ async getRefundRecordsCrossTeam(params) {
393
+ const { startDate, endDate, page = 1, pageSize = 20 } = params;
394
+ if (!startDate || !endDate) {
395
+ throw new chunkY3UJVC2L_cjs.PlolinkError("startDate and endDate are required", "MISSING_PARAMS");
396
+ }
397
+ if (pageSize > 100) {
398
+ throw new chunkY3UJVC2L_cjs.PlolinkError("pageSize must not exceed 100", "INVALID_PAGE_SIZE");
399
+ }
400
+ return this.client.axiosInstance.get("/api/v1/payments/refund/records:cross-team", {
401
+ params: {
402
+ startDate,
403
+ endDate,
404
+ page,
405
+ pageSize
406
+ }
407
+ });
408
+ }
409
+ };
410
+
411
+ exports.Billing = Billing;
412
+ //# sourceMappingURL=index.cjs.map
413
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/modules/billing/index.ts"],"names":["PlolinkError","Poller"],"mappings":";;;;;;AAgGO,IAAM,UAAN,MAAc;AAAA,EAGnB,YAAY,MAAA,EAAuB;AACjC,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAa,UAAA,GAAmC;AAC9C,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,aAAA,CAAc,GAAA,CAAI,0BAA0B,CAAA;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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ACA,IAAA;AAAA,QACA;AAAA;AACF,KACD,CAAA;AAAA,EACH;AACF","file":"index.cjs","sourcesContent":["/**\n * 充值消费模块\n * \n * @description\n * 提供完整的充值消费相关功能,包括:\n * - 余额查询\n * - 微信扫码充值(支持可选生成二维码图片)\n * - 订单状态查询和轮询\n * - 消费/充值/开票/退费记录查询\n * - 消耗统计\n * - 对公账户信息\n * \n * @example\n * ```typescript\n * import { PlolinkClient } from '@plolink/sdk';\n * import { Billing } from '@plolink/sdk/billing';\n * \n * const client = new PlolinkClient({\n * mode: 'apiKey',\n * apiKey: 'your-api-key'\n * });\n * \n * const billing = new Billing(client);\n * \n * // 查询余额\n * const balance = await billing.getBalance();\n * console.log(`当前余额: ${balance.balance}`);\n * \n * // 发起充值(含二维码图片)\n * const result = await billing.createRecharge({\n * amount: 100,\n * needQrCodeImage: true\n * });\n * console.log(`请扫码支付: ${result.qrCodeImageUrl}`);\n * \n * // 轮询订单状态\n * const poller = billing.watchOrderStatus(result.orderNo, (status) => {\n * console.log(`订单状态: ${status.status}`);\n * if (status.status === 'success') {\n * console.log('支付成功!');\n * }\n * });\n * ```\n * \n * @module billing\n */\n\nimport { PlolinkClient } from '../../core/client';\nimport { Poller } from '../../common/poller';\nimport { PlolinkError } from '../../core/error';\nimport type {\n BalanceInfo,\n CreateRechargeParams,\n WechatRechargeResult,\n OrderStatusResult,\n ConsumptionStats,\n PaginationParams,\n PaginatedResult,\n ConsumptionRecord,\n RechargeRecord,\n InvoiceRecord,\n RefundRecord,\n CompanyAccount,\n CrossTeamQueryParams,\n CrossTeamPaginatedResult,\n InvoiceRecordCrossTeam,\n RechargeRecordCrossTeam,\n ConsumptionRecordCrossTeam,\n RefundRecordCrossTeam,\n} from '../../types/billing';\n\nexport type {\n BalanceInfo,\n CreateRechargeParams,\n WechatRechargeResult,\n OrderStatus,\n OrderStatusResult,\n ConsumptionStats,\n PaginationParams,\n PaginatedResult,\n ConsumptionRecord,\n RechargeRecord,\n InvoiceRecord,\n RefundRecord,\n CompanyAccount,\n CrossTeamQueryParams,\n CrossTeamPaginatedResult,\n InvoiceRecordCrossTeam,\n RechargeRecordCrossTeam,\n ConsumptionRecordCrossTeam,\n RefundRecordCrossTeam,\n} from '../../types/billing';\n\n/**\n * 充值消费模块\n */\nexport class Billing {\n private client: PlolinkClient;\n\n constructor(client: PlolinkClient) {\n this.client = client;\n }\n\n /**\n * 获取团队余额信息\n * \n * @returns 余额信息,包括可用余额和可开票金额\n * @throws {PlolinkError} 当请求失败时抛出\n * \n * @example\n * ```typescript\n * const balance = await billing.getBalance();\n * console.log(`余额: ${balance.balance}, 可开票: ${balance.invoiceableAmount}`);\n * ```\n */\n public async getBalance(): Promise<BalanceInfo> {\n return this.client.axiosInstance.get('/api/v1/payments/balance');\n }\n\n /**\n * 创建微信充值订单\n * \n * @param params - 充值参数\n * @returns 充值订单信息,包含二维码URL和订单号\n * @throws {PlolinkError} 当金额无效或创建失败时抛出\n * \n * @example\n * ```typescript\n * // 基础充值(仅返回二维码URL)\n * const result = await billing.createRecharge({\n * amount: 100,\n * description: '充值100元'\n * });\n * console.log(`请使用微信扫描: ${result.qrCodeUrl}`);\n * \n * // 充值并获取二维码图片\n * const result = await billing.createRecharge({\n * amount: 100,\n * needQrCodeImage: true\n * });\n * console.log(`二维码图片地址: ${result.qrCodeImageUrl}`);\n * ```\n */\n public async createRecharge(params: CreateRechargeParams): Promise<WechatRechargeResult> {\n const { amount, description, needQrCodeImage } = params;\n \n if (amount <= 0) {\n throw new PlolinkError('Amount must be greater than 0', 'INVALID_AMOUNT');\n }\n\n return this.client.axiosInstance.post('/api/v1/payments/recharge/wechat', {\n amount,\n description,\n needQrCodeImage,\n });\n }\n\n /**\n * 查询订单状态\n * \n * @param orderNo - 订单号\n * @returns 订单状态信息\n * @throws {PlolinkError} 当订单不存在时抛出\n * \n * @example\n * ```typescript\n * const status = await billing.getOrderStatus('ORDER_123');\n * console.log(`订单状态: ${status.status}`);\n * ```\n */\n public async getOrderStatus(orderNo: string): Promise<OrderStatusResult> {\n // 通过充值记录接口查询订单状态\n const records = await this.getRechargeRecords();\n const record = records.find((r) => r.orderId === orderNo);\n \n if (!record) {\n throw new PlolinkError(`Order not found: ${orderNo}`, 'ORDER_NOT_FOUND');\n }\n\n return {\n orderNo,\n status: record.status,\n amount: record.amount,\n createdAt: record.createdAt,\n };\n }\n\n /**\n * 轮询订单状态\n * \n * @description\n * 创建一个轮询器持续监听订单状态变化,直到订单达到终态(success/failed/closed)。\n * 使用指数退避策略,初始间隔1秒,最大间隔30秒。\n * \n * @param orderNo - 订单号\n * @param onStatusChange - 状态变化回调函数\n * @returns Poller实例,可用于手动停止轮询\n * \n * @example\n * ```typescript\n * const poller = billing.watchOrderStatus('ORDER_123', (status) => {\n * console.log(`状态更新: ${status.status}`);\n * \n * if (status.status === 'success') {\n * console.log('支付成功!');\n * } else if (status.status === 'failed') {\n * console.error('支付失败!');\n * }\n * });\n * \n * // 开始轮询\n * poller.start();\n * \n * // 需要时可以手动停止\n * // poller.stop();\n * ```\n */\n public watchOrderStatus(\n orderNo: string,\n onStatusChange: (status: OrderStatusResult) => void\n ): Poller<OrderStatusResult> {\n const poller = new Poller<OrderStatusResult>({\n task: () => this.getOrderStatus(orderNo),\n onResult: onStatusChange,\n shouldStop: (status) => {\n return ['success', 'failed', 'closed'].includes(status.status);\n },\n initialInterval: 1000,\n maxInterval: 30000,\n backoffFactor: 1.5,\n onError: (error) => {\n this.client.logger.error('Order polling error', { error, orderNo });\n },\n });\n\n // 自动启动\n void poller.start();\n\n return poller;\n }\n\n /**\n * 获取消耗统计\n * \n * @returns 消耗统计信息(今日/7天/30天)\n * @throws {PlolinkError} 当请求失败时抛出\n * \n * @example\n * ```typescript\n * const stats = await billing.getConsumptionStats();\n * console.log(`今日消耗: ${stats.today}`);\n * console.log(`7天消耗: ${stats.last7Days}`);\n * console.log(`30天消耗: ${stats.last30Days}`);\n * ```\n */\n public async getConsumptionStats(): Promise<ConsumptionStats> {\n return this.client.axiosInstance.get('/api/v1/payments/consumption/stats');\n }\n\n /**\n * 获取消费记录(分页)\n * \n * @param params - 分页参数\n * @returns 消费记录列表和总数\n * @throws {PlolinkError} 当请求失败时抛出\n * \n * @example\n * ```typescript\n * const result = await billing.getConsumptionRecords({\n * page: 1,\n * pageSize: 20\n * });\n * console.log(`共 ${result.total} 条记录`);\n * result.list.forEach(record => {\n * console.log(`消费: ${record.amount}, 用途: ${record.purpose}`);\n * });\n * ```\n */\n public async getConsumptionRecords(\n params: PaginationParams = {}\n ): Promise<PaginatedResult<ConsumptionRecord>> {\n const { page = 1, pageSize = 20 } = params;\n return this.client.axiosInstance.get('/api/v1/payments/consumption/records', {\n params: { page, pageSize },\n });\n }\n\n /**\n * 获取充值记录\n * \n * @returns 充值记录列表\n * @throws {PlolinkError} 当请求失败时抛出\n * \n * @example\n * ```typescript\n * const records = await billing.getRechargeRecords();\n * records.forEach(record => {\n * console.log(`${record.createdAt}: ${record.amount}, 状态: ${record.status}`);\n * });\n * ```\n */\n public async getRechargeRecords(): Promise<RechargeRecord[]> {\n return this.client.axiosInstance.get('/api/v1/payments/recharge/records');\n }\n\n /**\n * 获取开票记录\n * \n * @returns 开票记录列表\n * @throws {PlolinkError} 当请求失败时抛出\n * \n * @example\n * ```typescript\n * const records = await billing.getInvoiceRecords();\n * records.forEach(record => {\n * console.log(`发票: ${record.invoiceNumber}, 金额: ${record.amount}`);\n * });\n * ```\n */\n public async getInvoiceRecords(): Promise<InvoiceRecord[]> {\n return this.client.axiosInstance.get('/api/v1/payments/invoice/records');\n }\n\n /**\n * 获取退费记录\n * \n * @returns 退费记录列表\n * @throws {PlolinkError} 当请求失败时抛出\n * \n * @example\n * ```typescript\n * const records = await billing.getRefundRecords();\n * records.forEach(record => {\n * console.log(`退费: ${record.amount}, 备注: ${record.remark}`);\n * });\n * ```\n */\n public async getRefundRecords(): Promise<RefundRecord[]> {\n return this.client.axiosInstance.get('/api/v1/payments/refund/records');\n }\n\n /**\n * 获取对公账户信息\n * \n * @returns 对公账户信息\n * @throws {PlolinkError} 当请求失败时抛出\n * \n * @example\n * ```typescript\n * const account = await billing.getCompanyAccount();\n * console.log(`账户名: ${account.accountName}`);\n * console.log(`账号: ${account.accountNumber}`);\n * console.log(`开户行: ${account.bankName}`);\n * ```\n */\n public async getCompanyAccount(): Promise<CompanyAccount> {\n return this.client.axiosInstance.get('/api/v1/payments/company-account');\n }\n\n // ============ 跨团队查询接口 ============\n\n /**\n * 获取跨团队开票记录\n * \n * 用于财务人员在多个团队中拥有财务权限时查询所有可管理团队的开票记录\n * \n * @param params - 查询参数\n * @returns 分页结果(包含团队名称)\n * @throws {PlolinkError} 当参数无效或请求失败时抛出\n * \n * @example\n * ```typescript\n * const result = await billing.getInvoiceRecordsCrossTeam({\n * startDate: '2025-01-01T00:00:00.000Z',\n * endDate: '2025-01-31T23:59:59.999Z',\n * page: 1,\n * pageSize: 20\n * });\n * \n * console.log(`共查询到 ${result.total} 条记录`);\n * result.list.forEach(record => {\n * console.log(`团队: ${record.teamName}, 发票号: ${record.invoiceNumber}, 金额: ${record.amount}`);\n * });\n * ```\n */\n public async getInvoiceRecordsCrossTeam(\n params: CrossTeamQueryParams\n ): Promise<CrossTeamPaginatedResult<InvoiceRecordCrossTeam>> {\n const { startDate, endDate, page = 1, pageSize = 20 } = params;\n\n if (!startDate || !endDate) {\n throw new PlolinkError('startDate and endDate are required', 'MISSING_PARAMS');\n }\n\n if (pageSize > 100) {\n throw new PlolinkError('pageSize must not exceed 100', 'INVALID_PAGE_SIZE');\n }\n\n return this.client.axiosInstance.get('/api/v1/payments/invoice/records:cross-team', {\n params: {\n startDate,\n endDate,\n page,\n pageSize,\n },\n });\n }\n\n /**\n * 获取跨团队充值记录\n * \n * 用于财务人员在多个团队中拥有财务权限时查询所有可管理团队的充值记录\n * \n * @param params - 查询参数\n * @returns 分页结果(包含团队名称)\n * @throws {PlolinkError} 当参数无效或请求失败时抛出\n * \n * @example\n * ```typescript\n * const result = await billing.getRechargeRecordsCrossTeam({\n * startDate: '2025-01-01T00:00:00.000Z',\n * endDate: '2025-01-31T23:59:59.999Z',\n * page: 1,\n * pageSize: 20\n * });\n * \n * console.log(`共查询到 ${result.total} 条记录`);\n * result.list.forEach(record => {\n * console.log(`团队: ${record.teamName}, 金额: ${record.amount}, 状态: ${record.status}`);\n * });\n * ```\n */\n public async getRechargeRecordsCrossTeam(\n params: CrossTeamQueryParams\n ): Promise<CrossTeamPaginatedResult<RechargeRecordCrossTeam>> {\n const { startDate, endDate, page = 1, pageSize = 20 } = params;\n\n if (!startDate || !endDate) {\n throw new PlolinkError('startDate and endDate are required', 'MISSING_PARAMS');\n }\n\n if (pageSize > 100) {\n throw new PlolinkError('pageSize must not exceed 100', 'INVALID_PAGE_SIZE');\n }\n\n return this.client.axiosInstance.get('/api/v1/payments/recharge/records:cross-team', {\n params: {\n startDate,\n endDate,\n page,\n pageSize,\n },\n });\n }\n\n /**\n * 获取跨团队消费记录\n * \n * 用于财务人员在多个团队中拥有财务权限时查询所有可管理团队的消费记录\n * \n * @param params - 查询参数\n * @returns 分页结果(包含团队名称)\n * @throws {PlolinkError} 当参数无效或请求失败时抛出\n * \n * @example\n * ```typescript\n * const result = await billing.getConsumptionRecordsCrossTeam({\n * startDate: '2025-01-01T00:00:00.000Z',\n * endDate: '2025-01-31T23:59:59.999Z',\n * page: 1,\n * pageSize: 20\n * });\n * \n * console.log(`共查询到 ${result.total} 条记录`);\n * result.list.forEach(record => {\n * console.log(`团队: ${record.teamName}, 金额: ${record.amount}, 用途: ${record.purpose}`);\n * });\n * ```\n */\n public async getConsumptionRecordsCrossTeam(\n params: CrossTeamQueryParams\n ): Promise<CrossTeamPaginatedResult<ConsumptionRecordCrossTeam>> {\n const { startDate, endDate, page = 1, pageSize = 20 } = params;\n\n if (!startDate || !endDate) {\n throw new PlolinkError('startDate and endDate are required', 'MISSING_PARAMS');\n }\n\n if (pageSize > 100) {\n throw new PlolinkError('pageSize must not exceed 100', 'INVALID_PAGE_SIZE');\n }\n\n return this.client.axiosInstance.get('/api/v1/payments/consumption/records:cross-team', {\n params: {\n startDate,\n endDate,\n page,\n pageSize,\n },\n });\n }\n\n /**\n * 获取跨团队退费记录\n * \n * 用于财务人员在多个团队中拥有财务权限时查询所有可管理团队的退费记录\n * \n * @param params - 查询参数\n * @returns 分页结果(包含团队名称)\n * @throws {PlolinkError} 当参数无效或请求失败时抛出\n * \n * @example\n * ```typescript\n * const result = await billing.getRefundRecordsCrossTeam({\n * startDate: '2025-01-01T00:00:00.000Z',\n * endDate: '2025-01-31T23:59:59.999Z',\n * page: 1,\n * pageSize: 20\n * });\n * \n * console.log(`共查询到 ${result.total} 条记录`);\n * result.list.forEach(record => {\n * console.log(`团队: ${record.teamName}, 金额: ${record.amount}, 备注: ${record.remark}`);\n * });\n * ```\n */\n public async getRefundRecordsCrossTeam(\n params: CrossTeamQueryParams\n ): Promise<CrossTeamPaginatedResult<RefundRecordCrossTeam>> {\n const { startDate, endDate, page = 1, pageSize = 20 } = params;\n\n if (!startDate || !endDate) {\n throw new PlolinkError('startDate and endDate are required', 'MISSING_PARAMS');\n }\n\n if (pageSize > 100) {\n throw new PlolinkError('pageSize must not exceed 100', 'INVALID_PAGE_SIZE');\n }\n\n return this.client.axiosInstance.get('/api/v1/payments/refund/records:cross-team', {\n params: {\n startDate,\n endDate,\n page,\n pageSize,\n },\n });\n }\n}\n"]}