@pisell/pisellos 3.0.55 → 3.0.57

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 (268) hide show
  1. package/dist/core/index.js +2 -1
  2. package/dist/effects/index.d.ts +4 -3
  3. package/dist/effects/index.js +15 -6
  4. package/dist/modules/AccountList/index.d.ts +7 -1
  5. package/dist/modules/AccountList/index.js +81 -14
  6. package/dist/modules/AccountList/types.d.ts +28 -0
  7. package/dist/modules/AccountList/types.js +8 -0
  8. package/dist/modules/Cart/index.js +1 -1
  9. package/dist/modules/Cart/utils/changePrice.d.ts +2 -2
  10. package/dist/modules/Cart/utils/changePrice.js +1 -1
  11. package/dist/modules/Customer/constants.d.ts +7 -0
  12. package/dist/modules/Customer/constants.js +12 -0
  13. package/dist/modules/Customer/index.d.ts +122 -0
  14. package/dist/modules/Customer/index.js +697 -0
  15. package/dist/modules/Customer/types.d.ts +146 -0
  16. package/dist/modules/Customer/types.js +41 -0
  17. package/dist/modules/Payment/cash.d.ts +11 -0
  18. package/dist/modules/Payment/cash.js +78 -0
  19. package/dist/modules/Payment/eftpos.d.ts +11 -0
  20. package/dist/modules/Payment/eftpos.js +80 -0
  21. package/dist/modules/Payment/index.d.ts +273 -9
  22. package/dist/modules/Payment/index.js +2525 -109
  23. package/dist/modules/Payment/types.d.ts +382 -30
  24. package/dist/modules/Payment/types.js +116 -14
  25. package/dist/modules/Payment/wallet.d.ts +11 -0
  26. package/dist/modules/Payment/wallet.js +78 -0
  27. package/dist/modules/Payment/walletpass.d.ts +0 -0
  28. package/dist/modules/Payment/walletpass.js +0 -0
  29. package/dist/modules/ProductList/index.d.ts +14 -3
  30. package/dist/modules/ProductList/index.js +58 -44
  31. package/dist/modules/ProductList/types.d.ts +0 -1
  32. package/dist/modules/Rules/index.js +27 -14
  33. package/dist/modules/Rules/types.d.ts +1 -0
  34. package/dist/modules/index.d.ts +1 -0
  35. package/dist/modules/index.js +1 -0
  36. package/dist/plugins/app-types/app/app.d.ts +83 -0
  37. package/dist/plugins/app-types/app/const.d.ts +4 -0
  38. package/dist/plugins/app-types/app/index.d.ts +14 -0
  39. package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
  40. package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
  41. package/dist/plugins/app-types/config.d.ts +3 -0
  42. package/dist/plugins/app-types/cookie/index.d.ts +13 -0
  43. package/dist/plugins/app-types/data/index.d.ts +8 -0
  44. package/dist/plugins/app-types/history/config.d.ts +24 -0
  45. package/dist/plugins/app-types/history/index.d.ts +20 -0
  46. package/dist/plugins/app-types/history/type.d.ts +2 -0
  47. package/dist/plugins/app-types/hooks/index.d.ts +12 -0
  48. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  49. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  50. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  51. package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  52. package/dist/plugins/app-types/index.d.ts +6 -0
  53. package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
  54. package/dist/plugins/app-types/locales/en.d.ts +3 -0
  55. package/dist/plugins/app-types/locales/index.d.ts +37 -0
  56. package/dist/plugins/app-types/locales/original.d.ts +3 -0
  57. package/dist/plugins/app-types/locales/type.d.ts +19 -0
  58. package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
  59. package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
  60. package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
  61. package/dist/plugins/app-types/logger/index.d.ts +122 -0
  62. package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
  63. package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
  64. package/dist/plugins/app-types/models/global.d.ts +32 -0
  65. package/dist/plugins/app-types/models/index.d.ts +45 -0
  66. package/dist/plugins/app-types/models/type.d.ts +2 -0
  67. package/dist/plugins/app-types/package.json +15 -0
  68. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  69. package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
  70. package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
  71. package/dist/plugins/app-types/request/cache.d.ts +46 -0
  72. package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
  73. package/dist/plugins/app-types/request/config.d.ts +3 -0
  74. package/dist/plugins/app-types/request/constants.d.ts +2 -0
  75. package/dist/plugins/app-types/request/index.d.ts +24 -0
  76. package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
  77. package/dist/plugins/app-types/request/type.d.ts +41 -0
  78. package/dist/plugins/app-types/request/utils.d.ts +46 -0
  79. package/dist/plugins/app-types/routes/config.d.ts +7 -0
  80. package/dist/plugins/app-types/routes/index.d.ts +28 -0
  81. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  82. package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
  83. package/dist/plugins/app-types/socket/constants.d.ts +33 -0
  84. package/dist/plugins/app-types/socket/events.d.ts +31 -0
  85. package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
  86. package/dist/plugins/app-types/socket/index.d.ts +61 -0
  87. package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
  88. package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
  89. package/dist/plugins/app-types/socket/socket.d.ts +129 -0
  90. package/dist/plugins/app-types/socket/types.d.ts +85 -0
  91. package/dist/plugins/app-types/storage/index.d.ts +17 -0
  92. package/dist/plugins/app-types/tasks/index.d.ts +77 -0
  93. package/dist/plugins/app-types/tasks/type.d.ts +62 -0
  94. package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
  95. package/dist/plugins/app-types/type.d.ts +2 -0
  96. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  97. package/dist/plugins/app-types/variables/config.d.ts +3 -0
  98. package/dist/plugins/app-types/variables/index.d.ts +6 -0
  99. package/dist/plugins/app-types/variables/type.d.ts +2 -0
  100. package/dist/plugins/app-types/website/index.d.ts +6 -0
  101. package/dist/plugins/app.d.ts +8 -0
  102. package/dist/plugins/app.js +1 -0
  103. package/dist/plugins/window.d.ts +1 -0
  104. package/dist/solution/BookingByStep/index.js +59 -35
  105. package/dist/solution/BookingByStep/types.d.ts +3 -2
  106. package/dist/solution/BookingTicket/index.d.ts +172 -0
  107. package/dist/solution/BookingTicket/index.js +665 -0
  108. package/dist/solution/BookingTicket/types.d.ts +68 -0
  109. package/dist/solution/BookingTicket/types.js +43 -0
  110. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  111. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
  112. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  113. package/dist/solution/BookingTicket/utils/scan/handleScan.js +174 -0
  114. package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  115. package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
  116. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  117. package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
  118. package/dist/solution/BuyTickets/index.d.ts +2 -2
  119. package/dist/solution/BuyTickets/index.js +1 -1
  120. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  121. package/dist/solution/Checkout/index.d.ts +181 -0
  122. package/dist/solution/Checkout/index.js +1596 -0
  123. package/dist/solution/Checkout/types.d.ts +550 -0
  124. package/dist/solution/Checkout/types.js +132 -0
  125. package/dist/solution/Checkout/utils/index.d.ts +73 -0
  126. package/dist/solution/Checkout/utils/index.js +371 -0
  127. package/dist/solution/ShopDiscount/index.js +4 -2
  128. package/dist/solution/index.d.ts +2 -0
  129. package/dist/solution/index.js +3 -1
  130. package/dist/types/index.d.ts +3 -1
  131. package/dist/utils/task.d.ts +40 -0
  132. package/dist/utils/task.js +171 -0
  133. package/dist/utils/watch.d.ts +102 -0
  134. package/dist/utils/watch.js +294 -0
  135. package/lib/core/index.js +1 -1
  136. package/lib/effects/index.d.ts +4 -3
  137. package/lib/effects/index.js +4 -1
  138. package/lib/modules/AccountList/index.d.ts +7 -1
  139. package/lib/modules/AccountList/index.js +27 -0
  140. package/lib/modules/AccountList/types.d.ts +28 -0
  141. package/lib/modules/Cart/index.js +1 -1
  142. package/lib/modules/Cart/utils/changePrice.d.ts +2 -2
  143. package/lib/modules/Cart/utils/changePrice.js +1 -1
  144. package/lib/modules/Customer/constants.d.ts +7 -0
  145. package/lib/modules/Customer/constants.js +39 -0
  146. package/lib/modules/Customer/index.d.ts +122 -0
  147. package/lib/modules/Customer/index.js +440 -0
  148. package/lib/modules/Customer/types.d.ts +146 -0
  149. package/lib/modules/Customer/types.js +37 -0
  150. package/lib/modules/Payment/cash.d.ts +11 -0
  151. package/lib/modules/Payment/cash.js +51 -0
  152. package/lib/modules/Payment/eftpos.d.ts +11 -0
  153. package/lib/modules/Payment/eftpos.js +51 -0
  154. package/lib/modules/Payment/index.d.ts +273 -9
  155. package/lib/modules/Payment/index.js +1285 -50
  156. package/lib/modules/Payment/types.d.ts +382 -30
  157. package/lib/modules/Payment/types.js +41 -6
  158. package/lib/modules/Payment/wallet.d.ts +11 -0
  159. package/lib/modules/Payment/wallet.js +51 -0
  160. package/lib/modules/Payment/walletpass.d.ts +0 -0
  161. package/lib/modules/Payment/walletpass.js +0 -0
  162. package/lib/modules/ProductList/index.d.ts +14 -3
  163. package/lib/modules/ProductList/index.js +42 -28
  164. package/lib/modules/ProductList/types.d.ts +0 -1
  165. package/lib/modules/Rules/index.js +20 -12
  166. package/lib/modules/Rules/types.d.ts +1 -0
  167. package/lib/modules/index.d.ts +1 -0
  168. package/lib/modules/index.js +2 -0
  169. package/lib/plugins/app-types/app/app.d.ts +83 -0
  170. package/lib/plugins/app-types/app/const.d.ts +4 -0
  171. package/lib/plugins/app-types/app/index.d.ts +14 -0
  172. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
  173. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
  174. package/lib/plugins/app-types/config.d.ts +3 -0
  175. package/lib/plugins/app-types/cookie/index.d.ts +13 -0
  176. package/lib/plugins/app-types/data/index.d.ts +8 -0
  177. package/lib/plugins/app-types/history/config.d.ts +24 -0
  178. package/lib/plugins/app-types/history/index.d.ts +20 -0
  179. package/lib/plugins/app-types/history/type.d.ts +2 -0
  180. package/lib/plugins/app-types/hooks/index.d.ts +12 -0
  181. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  182. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  183. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  184. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  185. package/lib/plugins/app-types/index.d.ts +6 -0
  186. package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
  187. package/lib/plugins/app-types/locales/en.d.ts +3 -0
  188. package/lib/plugins/app-types/locales/index.d.ts +37 -0
  189. package/lib/plugins/app-types/locales/original.d.ts +3 -0
  190. package/lib/plugins/app-types/locales/type.d.ts +19 -0
  191. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
  192. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
  193. package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
  194. package/lib/plugins/app-types/logger/index.d.ts +122 -0
  195. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
  196. package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
  197. package/lib/plugins/app-types/models/global.d.ts +32 -0
  198. package/lib/plugins/app-types/models/index.d.ts +45 -0
  199. package/lib/plugins/app-types/models/type.d.ts +2 -0
  200. package/lib/plugins/app-types/package.json +15 -0
  201. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  202. package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
  203. package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
  204. package/lib/plugins/app-types/request/cache.d.ts +46 -0
  205. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
  206. package/lib/plugins/app-types/request/config.d.ts +3 -0
  207. package/lib/plugins/app-types/request/constants.d.ts +2 -0
  208. package/lib/plugins/app-types/request/index.d.ts +24 -0
  209. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
  210. package/lib/plugins/app-types/request/type.d.ts +41 -0
  211. package/lib/plugins/app-types/request/utils.d.ts +46 -0
  212. package/lib/plugins/app-types/routes/config.d.ts +7 -0
  213. package/lib/plugins/app-types/routes/index.d.ts +28 -0
  214. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  215. package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
  216. package/lib/plugins/app-types/socket/constants.d.ts +33 -0
  217. package/lib/plugins/app-types/socket/events.d.ts +31 -0
  218. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
  219. package/lib/plugins/app-types/socket/index.d.ts +61 -0
  220. package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
  221. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
  222. package/lib/plugins/app-types/socket/socket.d.ts +129 -0
  223. package/lib/plugins/app-types/socket/types.d.ts +85 -0
  224. package/lib/plugins/app-types/storage/index.d.ts +17 -0
  225. package/lib/plugins/app-types/tasks/index.d.ts +77 -0
  226. package/lib/plugins/app-types/tasks/type.d.ts +62 -0
  227. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
  228. package/lib/plugins/app-types/type.d.ts +2 -0
  229. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  230. package/lib/plugins/app-types/variables/config.d.ts +3 -0
  231. package/lib/plugins/app-types/variables/index.d.ts +6 -0
  232. package/lib/plugins/app-types/variables/type.d.ts +2 -0
  233. package/lib/plugins/app-types/website/index.d.ts +6 -0
  234. package/lib/plugins/app.d.ts +8 -0
  235. package/lib/plugins/app.js +17 -0
  236. package/lib/plugins/window.d.ts +1 -0
  237. package/lib/solution/BookingByStep/index.js +40 -29
  238. package/lib/solution/BookingByStep/types.d.ts +3 -2
  239. package/lib/solution/BookingTicket/index.d.ts +172 -0
  240. package/lib/solution/BookingTicket/index.js +399 -0
  241. package/lib/solution/BookingTicket/types.d.ts +68 -0
  242. package/lib/solution/BookingTicket/types.js +72 -0
  243. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  244. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
  245. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  246. package/lib/solution/BookingTicket/utils/scan/handleScan.js +125 -0
  247. package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  248. package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
  249. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  250. package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
  251. package/lib/solution/BuyTickets/index.d.ts +2 -2
  252. package/lib/solution/BuyTickets/index.js +1 -1
  253. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  254. package/lib/solution/Checkout/index.d.ts +181 -0
  255. package/lib/solution/Checkout/index.js +864 -0
  256. package/lib/solution/Checkout/types.d.ts +550 -0
  257. package/lib/solution/Checkout/types.js +75 -0
  258. package/lib/solution/Checkout/utils/index.d.ts +73 -0
  259. package/lib/solution/Checkout/utils/index.js +266 -0
  260. package/lib/solution/ShopDiscount/index.js +2 -1
  261. package/lib/solution/index.d.ts +2 -0
  262. package/lib/solution/index.js +5 -1
  263. package/lib/types/index.d.ts +3 -1
  264. package/lib/utils/task.d.ts +40 -0
  265. package/lib/utils/task.js +109 -0
  266. package/lib/utils/watch.d.ts +102 -0
  267. package/lib/utils/watch.js +217 -0
  268. package/package.json +4 -2
@@ -1,47 +1,399 @@
1
- export declare enum PaymentHooks {
2
- OnPaymentInit = "payment:onPaymentInit",
3
- OnPaymentSuccess = "payment:onPaymentSuccess",
4
- OnPaymentFailure = "payment:onPaymentFailure",
5
- OnPaymentRefund = "payment:onPaymentRefund"
1
+ /**
2
+ * 支付相关类型定义
3
+ */
4
+ /**
5
+ * 支付方式枚举
6
+ */
7
+ export declare enum PaymentMethodType {
8
+ Cash = "CASHMANUAL",
9
+ Eftpos = "EFTPOS",
10
+ Wallet = "WALLET"
6
11
  }
7
12
  /**
8
- * 支付方式
13
+ * 支付状态枚举
9
14
  */
10
- export type PaymentMethod = 'credit_card' | 'debit_card' | 'paypal' | 'alipay' | 'wechat_pay' | 'bank_transfer';
15
+ export declare enum PaymentStatus {
16
+ /** 支付处理中 - 订单正在进行支付操作 */
17
+ Processing = "payment_processing",
18
+ /** 同步中 - 暂时不使用,为了向后兼容保留 */
19
+ Sync = "sync",
20
+ /** 部分支付 - 支付金额不足订单总金额 */
21
+ PartiallyPaid = "partially_paid",
22
+ /** 已完成 - 本地支付完成,后台自动同步到服务器 */
23
+ Finished = "finish"
24
+ }
11
25
  /**
12
- * 支付状态
26
+ * 任务状态枚举
27
+ */
28
+ export declare enum TaskRunStatus {
29
+ Pending = "pending",
30
+ Running = "running",
31
+ Success = "success",
32
+ Failed = "failed"
33
+ }
34
+ /**
35
+ * 支付方式信息
36
+ */
37
+ export interface PaymentMethod {
38
+ /** 支付方式ID */
39
+ id: number;
40
+ /** 支付方式代码 */
41
+ code: string;
42
+ /** 支付方式名称 */
43
+ name: string;
44
+ /** 支付方式类型 */
45
+ type: string;
46
+ /** 是否启用 */
47
+ enabled: boolean;
48
+ /** 其他配置信息 */
49
+ [key: string]: any;
50
+ }
51
+ /**
52
+ * 支付项
53
+ */
54
+ export interface PaymentItem {
55
+ /** 当前支付项的唯一 ID */
56
+ uuid: string;
57
+ /** 当前支付方式付出去多少钱 */
58
+ amount: string;
59
+ /** 支付类型,跟支付列表上对应的支付方式保持一致 */
60
+ code: string;
61
+ /** 支付类型id,跟支付列表上对应的支付方式保持一致 */
62
+ id: number;
63
+ /** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
64
+ name: string;
65
+ /** 支付类型type,跟支付列表上对应的支付方式保持一致 */
66
+ type: string;
67
+ /** 代金券、充值卡、积分卡等wallet pass id */
68
+ voucher_id?: string;
69
+ /** 拓展参数字段 */
70
+ metadata?: {
71
+ /** 钱箱 ID */
72
+ shop_wallet_pass_id?: string;
73
+ /** 唯一支付号 */
74
+ unique_payment_number?: string;
75
+ /** rouding规则 */
76
+ rounding_rule?: any;
77
+ };
78
+ /** rouding金额 */
79
+ rounding_amount?: string;
80
+ /** 三方支付手续费 */
81
+ service_charge?: {
82
+ percentage: string;
83
+ amount: string;
84
+ };
85
+ /** 该支付项是否已经同步给后端服务器(只有网络请求成功后才为true) */
86
+ isSynced?: boolean;
87
+ /** 同步错误信息(业务错误时记录错误信息,用于区分"未同步"和"同步失败") */
88
+ syncError?: {
89
+ error: string;
90
+ errorCode?: string;
91
+ statusCode?: number;
92
+ timestamp: number;
93
+ };
94
+ }
95
+ /**
96
+ * 订单信息
13
97
  */
14
- export type PaymentStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'refunded';
98
+ export interface OrderInfo {
99
+ /** 订单 id */
100
+ order_id: number;
101
+ /** 订单总金额 */
102
+ total_amount: string;
103
+ /** 是否是定金订单 */
104
+ is_deposit: number;
105
+ /** 定金金额 */
106
+ deposit_amount: string;
107
+ }
15
108
  /**
16
- * 支付信息
109
+ * 支付订单(简化版,仅保留支付相关信息)
17
110
  */
18
- export interface Payment {
111
+ export interface PaymentOrder {
112
+ /** 当前订单的唯一 ID */
113
+ uuid: string;
114
+ /** 订单ID(字符串类型,支持本地虚拟ID) */
19
115
  id: string;
20
- orderId: string;
21
- amount: number;
22
- currency: string;
23
- method: PaymentMethod;
24
- status: PaymentStatus;
25
- transactionId?: string;
26
- createdAt: Date;
27
- updatedAt: Date;
28
- metadata?: Record<string, any>;
116
+ /** 订单ID(数字类型,兼容旧版本) */
117
+ order_id: string;
118
+ /** 支付项列表 */
119
+ payment: PaymentItem[];
120
+ /** 修改的支付项列表 */
121
+ adjust_offline_payments: PaymentItem[];
122
+ /** 总计金额 */
123
+ total_amount: string;
124
+ /** 待付金额 */
125
+ expect_amount: string;
126
+ /** 支付状态 */
127
+ payment_status: PaymentStatus;
128
+ /** 是否是定金订单 */
129
+ is_deposit: number;
130
+ /** 定金金额 */
131
+ deposit_amount: string;
132
+ /** 总税费 */
133
+ tax_fee: string;
134
+ /** 原始订单数据(由 Checkout 模块传入) */
135
+ order_info?: any;
29
136
  }
30
137
  /**
31
- * 支付模块状态
138
+ * 支付状态
32
139
  */
33
140
  export interface PaymentState {
34
- currentPayment: Payment | null;
35
- paymentHistory: Payment[];
36
141
  }
37
142
  /**
38
- * 支付模块 API
143
+ * 推送订单参数(简化版)
144
+ */
145
+ export interface PushOrderParams {
146
+ /** 订单ID */
147
+ order_id: string;
148
+ /** 总金额 */
149
+ total_amount: string;
150
+ /** 是否是定金订单 */
151
+ is_deposit?: number;
152
+ /** 定金金额 */
153
+ deposit_amount?: string;
154
+ /** 原始订单数据(可选,由 Checkout 模块传入) */
155
+ order_info?: any;
156
+ }
157
+ /**
158
+ * 更新订单参数
159
+ */
160
+ export interface UpdateOrderParams {
161
+ /** 订单UUID */
162
+ uuid: string;
163
+ /** 更新的字段 */
164
+ [key: string]: any;
165
+ }
166
+ /**
167
+ * 支付项输入类型(允许 amount 为数字)
168
+ */
169
+ export interface PaymentItemInput {
170
+ /** 当前支付方式付出去多少钱 */
171
+ amount: string | number;
172
+ /** 支付类型,跟支付列表上对应的支付方式保持一致 */
173
+ code: string;
174
+ /** 支付类型id,跟支付列表上对应的支付方式保持一致 */
175
+ id: number;
176
+ /** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
177
+ name: string;
178
+ /** 支付类型type,跟支付列表上对应的支付方式保持一致 */
179
+ type: string;
180
+ /** 代金券、充值卡、积分卡等wallet pass id */
181
+ voucher_id?: string;
182
+ }
183
+ /**
184
+ * 推送支付项参数
185
+ */
186
+ export interface PushPaymentParams {
187
+ /** 订单UUID */
188
+ orderUuid: string;
189
+ /** 支付项信息 */
190
+ paymentItem: PaymentItemInput;
191
+ }
192
+ /**
193
+ * 更新支付项参数中的字段类型(允许 amount 为数字)
194
+ */
195
+ export interface PaymentUpdateFields {
196
+ /** 当前支付项的唯一 ID */
197
+ uuid?: string;
198
+ /** 当前支付方式付出去多少钱 */
199
+ amount?: string | number;
200
+ /** 支付类型,跟支付列表上对应的支付方式保持一致 */
201
+ code?: string;
202
+ /** 支付类型id,跟支付列表上对应的支付方式保持一致 */
203
+ id?: number;
204
+ /** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
205
+ name?: string;
206
+ /** 支付类型type,跟支付列表上对应的支付方式保持一致 */
207
+ type?: string;
208
+ /** 代金券、充值卡、积分卡等wallet pass id */
209
+ voucher_id?: string;
210
+ /** 该支付项是否已经同步给后端服务器(只有网络请求成功后才为true) */
211
+ isSynced?: boolean;
212
+ /** 同步错误信息(业务错误时记录错误信息,用于区分"未同步"和"同步失败") */
213
+ syncError?: {
214
+ error: string;
215
+ errorCode?: string;
216
+ statusCode?: number;
217
+ timestamp: number;
218
+ };
219
+ }
220
+ /**
221
+ * 更新支付项参数
222
+ */
223
+ export interface UpdatePaymentParams {
224
+ /** 订单UUID */
225
+ orderUuid: string;
226
+ /** 支付项UUID */
227
+ paymentUuid: string;
228
+ /** 更新的字段 */
229
+ params: PaymentUpdateFields;
230
+ }
231
+ /**
232
+ * 删除支付项参数
233
+ */
234
+ export interface DeletePaymentParams {
235
+ /** 订单UUID */
236
+ orderUuid: string;
237
+ /** 支付项UUID */
238
+ paymentUuid: string;
239
+ }
240
+ /**
241
+ * 现金支付接口
242
+ */
243
+ export interface CashPayment {
244
+ /** 处理现金支付 */
245
+ processCashPayment: (amount: number, orderUuid: string) => Promise<void>;
246
+ /** 获取现金余额 */
247
+ getCashBalance: () => Promise<number>;
248
+ }
249
+ /**
250
+ * Eftpos支付接口
251
+ */
252
+ export interface EftposPayment {
253
+ /** 处理Eftpos支付 */
254
+ processEftposPayment: (amount: number, orderUuid: string) => Promise<void>;
255
+ /** 检查Eftpos设备状态 */
256
+ checkDeviceStatus: () => Promise<boolean>;
257
+ }
258
+ /**
259
+ * 钱包支付接口
260
+ */
261
+ export interface WalletPayment {
262
+ /** 处理钱包支付 */
263
+ processWalletPayment: (amount: number, orderUuid: string, voucherId?: string) => Promise<void>;
264
+ /** 获取钱包余额 */
265
+ getWalletBalance: (voucherId: string) => Promise<number>;
266
+ }
267
+ /**
268
+ * 支付模块API接口
39
269
  */
40
270
  export interface PaymentModuleAPI {
41
- processPayment: (paymentId: string) => Promise<void>;
42
- getPayment: (paymentId: string) => Promise<Payment>;
43
- getPaymentHistory: () => Promise<Payment[]>;
44
- refund: (paymentId: string) => Promise<void>;
45
- getAvailablePaymentMethods: () => PaymentMethod[];
46
- checkPaymentStatus: (paymentId: string) => Promise<PaymentStatus>;
271
+ /** 现金支付相关方法 */
272
+ cash: CashPayment;
273
+ /** Eftpos支付相关方法 */
274
+ eftpos: EftposPayment;
275
+ /** 钱包支付相关方法 */
276
+ wallet: WalletPayment;
277
+ /** 获取支付方式列表 */
278
+ getPayMethodListAsync: () => Promise<PaymentMethod[]>;
279
+ /** 创建支付订单(仅保存支付相关信息) */
280
+ createPaymentOrderAsync: (params: PushOrderParams) => Promise<PaymentOrder>;
281
+ /** 根据订单UUID获取支付订单 */
282
+ getPaymentOrderByUuidAsync: (orderUuid: string) => Promise<PaymentOrder | null>;
283
+ /** 基于UUID替换订单ID */
284
+ replaceOrderIdByUuidAsync: (orderUuid: string, newOrderId: string) => Promise<PaymentOrder | null>;
285
+ /** 删除支付订单 */
286
+ deletePaymentOrderAsync: (orderUuid: string) => Promise<void>;
287
+ /** 获取支付项 */
288
+ getPaymentItemsAsync: (orderUuid: string) => Promise<PaymentItem[]>;
289
+ /** 为某个订单添加支付项 */
290
+ addPaymentItemAsync: (orderUuid: string, paymentItem: PaymentItemInput) => Promise<void>;
291
+ /** 删除支付项 */
292
+ deletePaymentItemAsync: (orderUuid: string, paymentUuid: string) => Promise<void>;
293
+ /** 更新支付项 */
294
+ updatePaymentItemAsync: (orderUuid: string, paymentUuid: string, params: PaymentUpdateFields) => Promise<void>;
295
+ /** 获取订单剩余待付金额 */
296
+ getRemainingAmountAsync: (orderUuid: string) => Promise<number>;
297
+ /** 获取订单剩余待付金额(基于用户输入的金额) */
298
+ getRemainingAmountWithInputAsync: (inputAmount: string | number, orderUuid: string) => Promise<number>;
299
+ /** 提交支付 */
300
+ submitPaymentAsync: (orderUuid: string) => Promise<{
301
+ status: 'success' | 'failed';
302
+ }>;
303
+ /** 获取部分支付的订单 */
304
+ getPartiallyPaidOrdersAsync: () => Promise<PaymentOrder[]>;
305
+ /** 获取未同步到服务器的订单 */
306
+ getUnsyncedOrdersAsync: () => Promise<PaymentOrder[]>;
307
+ /** 检测未同步的订单并重新加入任务队列 */
308
+ recheckAndRequeueUnsyncedOrders: () => Promise<number>;
309
+ /** 手动执行支付同步队列 */
310
+ runPaymentSyncQueue: () => Promise<void>;
311
+ /** @deprecated 使用 createPaymentOrderAsync 替代 */
312
+ pushOrderAsync: (params: PushOrderParams) => Promise<PaymentOrder>;
313
+ /** @deprecated 使用 getPaymentItemsAsync 替代 */
314
+ getPaymentAsync: (orderUuid: string) => Promise<PaymentItem[]>;
315
+ /** @deprecated 使用 addPaymentItemAsync 替代 */
316
+ pushPaymentAsync: (orderUuid: string, paymentItem: PaymentItemInput) => Promise<void>;
317
+ /** @deprecated 使用 deletePaymentItemAsync 替代 */
318
+ deletePaymentAsync: (orderUuid: string, paymentUuid: string) => Promise<void>;
319
+ /** @deprecated 使用 updatePaymentItemAsync 替代 */
320
+ updatePaymentAsync: (orderUuid: string, paymentUuid: string, params: PaymentUpdateFields) => Promise<void>;
321
+ /** @deprecated 使用 submitPaymentAsync 替代 */
322
+ submitPayAsync: (orderUuid?: string) => Promise<{
323
+ status: 'success' | 'failed';
324
+ }>;
325
+ /** @deprecated 使用 getRemainingAmountAsync 替代 */
326
+ getRemainingOrderAmountAsync: (orderUuid: string) => Promise<number>;
327
+ /** @deprecated 使用 getRemainingAmountWithInputAsync 替代 */
328
+ getRemainingOrderAmountWithInputAsync: (inputAmount: string | number, orderUuid: string) => Promise<number>;
329
+ }
330
+ /**
331
+ * 订单变化事件数据
332
+ */
333
+ export interface OnOrderChangedEventData {
334
+ /** 操作类型 */
335
+ action: 'add' | 'delete' | 'update' | 'payment_add' | 'payment_delete' | 'payment_update' | 'submit';
336
+ /** 当前订单 */
337
+ order: PaymentOrder;
338
+ /** 原始订单(仅在 update 操作时提供) */
339
+ originalOrder?: PaymentOrder;
340
+ /** 相关的支付项(仅在 payment_* 操作时提供) */
341
+ paymentItem?: PaymentItem;
342
+ }
343
+ /**
344
+ * 支付方式变化事件数据
345
+ */
346
+ export interface OnPaymentMethodsChangedEventData {
347
+ /** 旧的支付方式列表 */
348
+ oldMethods: PaymentMethod[];
349
+ /** 新的支付方式列表 */
350
+ newMethods: PaymentMethod[];
351
+ }
352
+ /**
353
+ * 支付同步错误事件数据
354
+ */
355
+ export interface OnPaymentSyncErrorEventData {
356
+ /** 订单UUID */
357
+ orderUuid: string;
358
+ /** 订单ID */
359
+ orderId: number;
360
+ /** 错误信息 */
361
+ error: string;
362
+ /** 错误代码 */
363
+ errorCode?: string;
364
+ /** HTTP状态码 */
365
+ statusCode?: number;
366
+ /** 错误发生时间 */
367
+ timestamp: number;
368
+ /** 响应数据(当HTTP请求成功但业务失败时) */
369
+ responseData?: any;
370
+ }
371
+ /**
372
+ * 支付同步成功事件数据
373
+ */
374
+ export interface OnPaymentSyncSuccessEventData {
375
+ /** 订单UUID */
376
+ orderUuid: string;
377
+ /** 订单ID */
378
+ orderId: number;
379
+ /** 成功时间 */
380
+ timestamp: number;
381
+ }
382
+ /**
383
+ * 支付钩子事件
384
+ */
385
+ export declare enum PaymentHooks {
386
+ OnPaymentMethodsLoaded = "payment:onPaymentMethodsLoaded",
387
+ OnPaymentMethodsChanged = "payment:onPaymentMethodsChanged",
388
+ OnOrderChanged = "payment:onOrderChanged",
389
+ OnOrderAdded = "payment:onOrderAdded",
390
+ OnOrderUpdated = "payment:onOrderUpdated",
391
+ OnOrderDeleted = "payment:onOrderDeleted",
392
+ OnPaymentAdded = "payment:onPaymentAdded",
393
+ OnPaymentUpdated = "payment:onPaymentUpdated",
394
+ OnPaymentDeleted = "payment:onPaymentDeleted",
395
+ OnPaymentSubmitted = "payment:onPaymentSubmitted",
396
+ OnOrderAmountChanged = "payment:onOrderAmountChanged",
397
+ OnPaymentSyncError = "payment:onPaymentSyncError",
398
+ OnPaymentSyncSuccess = "payment:onPaymentSyncSuccess"
47
399
  }
@@ -1,33 +1,135 @@
1
- // import { Order } from '../Order/types'
1
+ /**
2
+ * 支付相关类型定义
3
+ */
2
4
 
3
- export var PaymentHooks = /*#__PURE__*/function (PaymentHooks) {
4
- PaymentHooks["OnPaymentInit"] = "payment:onPaymentInit";
5
- PaymentHooks["OnPaymentSuccess"] = "payment:onPaymentSuccess";
6
- PaymentHooks["OnPaymentFailure"] = "payment:onPaymentFailure";
7
- PaymentHooks["OnPaymentRefund"] = "payment:onPaymentRefund";
8
- return PaymentHooks;
5
+ /**
6
+ * 支付方式枚举
7
+ */
8
+ export var PaymentMethodType = /*#__PURE__*/function (PaymentMethodType) {
9
+ PaymentMethodType["Cash"] = "CASHMANUAL";
10
+ PaymentMethodType["Eftpos"] = "EFTPOS";
11
+ PaymentMethodType["Wallet"] = "WALLET";
12
+ return PaymentMethodType;
13
+ }({});
14
+
15
+ /**
16
+ * 支付状态枚举
17
+ */
18
+ export var PaymentStatus = /*#__PURE__*/function (PaymentStatus) {
19
+ PaymentStatus["Processing"] = "payment_processing";
20
+ PaymentStatus["Sync"] = "sync";
21
+ PaymentStatus["PartiallyPaid"] = "partially_paid";
22
+ PaymentStatus["Finished"] = "finish";
23
+ return PaymentStatus;
24
+ }({});
25
+
26
+ /**
27
+ * 任务状态枚举
28
+ */
29
+ export var TaskRunStatus = /*#__PURE__*/function (TaskRunStatus) {
30
+ TaskRunStatus["Pending"] = "pending";
31
+ TaskRunStatus["Running"] = "running";
32
+ TaskRunStatus["Success"] = "success";
33
+ TaskRunStatus["Failed"] = "failed";
34
+ return TaskRunStatus;
9
35
  }({});
10
36
 
11
37
  /**
12
- * 支付方式
38
+ * 支付方式信息
39
+ */
40
+
41
+ /**
42
+ * 支付项
43
+ */
44
+
45
+ /**
46
+ * 订单信息
13
47
  */
14
48
 
15
- // 银行转账
49
+ /**
50
+ * 支付订单(简化版,仅保留支付相关信息)
51
+ */
16
52
 
17
53
  /**
18
54
  * 支付状态
19
55
  */
20
56
 
21
- // 已退款
57
+ /**
58
+ * 推送订单参数(简化版)
59
+ */
60
+
61
+ /**
62
+ * 更新订单参数
63
+ */
64
+
65
+ /**
66
+ * 支付项输入类型(允许 amount 为数字)
67
+ */
22
68
 
23
69
  /**
24
- * 支付信息
70
+ * 推送支付项参数
25
71
  */
26
72
 
27
73
  /**
28
- * 支付模块状态
74
+ * 更新支付项参数中的字段类型(允许 amount 为数字)
29
75
  */
30
76
 
31
77
  /**
32
- * 支付模块 API
33
- */
78
+ * 更新支付项参数
79
+ */
80
+
81
+ /**
82
+ * 删除支付项参数
83
+ */
84
+
85
+ /**
86
+ * 现金支付接口
87
+ */
88
+
89
+ /**
90
+ * Eftpos支付接口
91
+ */
92
+
93
+ /**
94
+ * 钱包支付接口
95
+ */
96
+
97
+ /**
98
+ * 支付模块API接口
99
+ */
100
+
101
+ /**
102
+ * 订单变化事件数据
103
+ */
104
+
105
+ /**
106
+ * 支付方式变化事件数据
107
+ */
108
+
109
+ /**
110
+ * 支付同步错误事件数据
111
+ */
112
+
113
+ /**
114
+ * 支付同步成功事件数据
115
+ */
116
+
117
+ /**
118
+ * 支付钩子事件
119
+ */
120
+ export var PaymentHooks = /*#__PURE__*/function (PaymentHooks) {
121
+ PaymentHooks["OnPaymentMethodsLoaded"] = "payment:onPaymentMethodsLoaded";
122
+ PaymentHooks["OnPaymentMethodsChanged"] = "payment:onPaymentMethodsChanged";
123
+ PaymentHooks["OnOrderChanged"] = "payment:onOrderChanged";
124
+ PaymentHooks["OnOrderAdded"] = "payment:onOrderAdded";
125
+ PaymentHooks["OnOrderUpdated"] = "payment:onOrderUpdated";
126
+ PaymentHooks["OnOrderDeleted"] = "payment:onOrderDeleted";
127
+ PaymentHooks["OnPaymentAdded"] = "payment:onPaymentAdded";
128
+ PaymentHooks["OnPaymentUpdated"] = "payment:onPaymentUpdated";
129
+ PaymentHooks["OnPaymentDeleted"] = "payment:onPaymentDeleted";
130
+ PaymentHooks["OnPaymentSubmitted"] = "payment:onPaymentSubmitted";
131
+ PaymentHooks["OnOrderAmountChanged"] = "payment:onOrderAmountChanged";
132
+ PaymentHooks["OnPaymentSyncError"] = "payment:onPaymentSyncError";
133
+ PaymentHooks["OnPaymentSyncSuccess"] = "payment:onPaymentSyncSuccess";
134
+ return PaymentHooks;
135
+ }({});
@@ -0,0 +1,11 @@
1
+ import { WalletPayment } from './types';
2
+ import type { PaymentModule } from './index';
3
+ /**
4
+ * 钱包支付实现
5
+ */
6
+ export declare class WalletPaymentImpl implements WalletPayment {
7
+ private paymentModule;
8
+ constructor(paymentModule: PaymentModule);
9
+ processWalletPayment(amount: number, orderUuid: string, voucherId?: string): Promise<void>;
10
+ getWalletBalance(voucherId: string): Promise<number>;
11
+ }