@pisell/private-materials 6.6.61 → 6.6.63

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 (203) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/booking/components/footer/amount.js +4 -3
  12. package/es/components/booking/components/footer/utils.js +10 -3
  13. package/es/components/booking/components/voucher/index.js +1 -1
  14. package/es/components/booking/info2/service/editService/index.js +76 -8
  15. package/es/components/booking/info2/service/editService/utils.d.ts +1 -0
  16. package/es/components/booking/info2/service/editService/utils.js +16 -0
  17. package/es/components/booking/payments/index.js +1 -1
  18. package/es/components/eftpos/PairModal/hooks.d.ts +27 -0
  19. package/es/components/eftpos/PairModal/hooks.js +67 -0
  20. package/es/components/eftpos/PairModal/index.d.ts +11 -0
  21. package/es/components/eftpos/PairModal/index.js +246 -0
  22. package/es/components/eftpos/PairModal/index.less +70 -0
  23. package/es/components/eftpos/SettlementModal/Action.d.ts +7 -0
  24. package/es/components/eftpos/SettlementModal/Action.js +141 -0
  25. package/es/components/eftpos/SettlementModal/index.d.ts +7 -0
  26. package/es/components/eftpos/SettlementModal/index.js +135 -0
  27. package/es/components/eftpos/SettlementModal/index.less +33 -0
  28. package/es/components/eftpos/SettlementModal/serve.d.ts +8 -0
  29. package/es/components/eftpos/SettlementModal/serve.js +171 -0
  30. package/es/components/eftpos/SettlementModal/types.d.ts +138 -0
  31. package/es/components/eftpos/SettlementModal/types.js +35 -0
  32. package/es/components/eftpos/SettlementModal/utils.d.ts +18 -0
  33. package/es/components/eftpos/SettlementModal/utils.js +351 -0
  34. package/es/components/eftpos/assets/mx51SCI.svg +15 -0
  35. package/es/components/eftpos/const.d.ts +3 -1
  36. package/es/components/eftpos/const.js +2 -0
  37. package/es/components/eftpos/device.d.ts +3 -1
  38. package/es/components/eftpos/device.js +14 -3
  39. package/es/components/eftpos/hooks.d.ts +13 -0
  40. package/es/components/eftpos/hooks.js +35 -0
  41. package/es/components/eftpos/index.js +198 -24
  42. package/es/components/eftpos/index.less +32 -1
  43. package/es/components/eftpos/locales.d.ts +80 -0
  44. package/es/components/eftpos/locales.js +205 -25
  45. package/es/components/eftpos/table.js +47 -3
  46. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
  47. package/es/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
  48. package/es/components/eftposPay/aggregatePayment/hooks/usePayment.js +145 -0
  49. package/es/components/eftposPay/aggregatePayment/index.d.ts +2 -1
  50. package/es/components/eftposPay/aggregatePayment/index.js +2 -1
  51. package/es/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
  52. package/es/components/eftposPay/aggregatePayment/mock.js +567 -0
  53. package/es/components/eftposPay/aggregatePayment/service.js +1 -0
  54. package/es/components/eftposPay/aggregatePayment/types.d.ts +12 -12
  55. package/es/components/eftposPay/aggregatePayment/types.js +4 -8
  56. package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
  57. package/es/components/eftposPay/aggregatePayment/utils/payment.js +231 -168
  58. package/es/components/eftposPay/amount.js +15 -1
  59. package/es/components/eftposPay/app.js +2 -3
  60. package/es/components/eftposPay/component/fail/failCustom.js +13 -4
  61. package/es/components/eftposPay/component/fail/index.js +12 -5
  62. package/es/components/eftposPay/component/fail/network.js +3 -0
  63. package/es/components/eftposPay/component/fail/unknow.js +8 -0
  64. package/es/components/eftposPay/component/manual/index.js +17 -3
  65. package/es/components/eftposPay/component/signature/index.js +3 -0
  66. package/es/components/eftposPay/const.d.ts +8 -3
  67. package/es/components/eftposPay/const.js +2 -0
  68. package/es/components/eftposPay/device.js +225 -38
  69. package/es/components/eftposPay/helper.d.ts +3 -0
  70. package/es/components/eftposPay/helper.js +2 -1
  71. package/es/components/eftposPay/hooks.d.ts +1 -1
  72. package/es/components/eftposPay/index.js +50 -13
  73. package/es/components/eftposPay/linkly/const.js +1 -1
  74. package/es/components/eftposPay/linkly/hooks/normal.js +21 -68
  75. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +20 -81
  76. package/es/components/eftposPay/linkly/index.js +11 -23
  77. package/es/components/eftposPay/locales.d.ts +15 -0
  78. package/es/components/eftposPay/locales.js +30 -15
  79. package/es/components/eftposPay/manufacturer.d.ts +1 -0
  80. package/es/components/eftposPay/manufacturer.js +4 -0
  81. package/es/components/eftposPay/mx51/Action.d.ts +6 -0
  82. package/es/components/eftposPay/mx51/Action.js +144 -0
  83. package/es/components/eftposPay/mx51/const.d.ts +5 -0
  84. package/es/components/eftposPay/mx51/const.js +69 -0
  85. package/es/components/eftposPay/mx51/index.d.ts +6 -0
  86. package/es/components/eftposPay/mx51/index.js +498 -0
  87. package/es/components/eftposPay/mx51/types.d.ts +142 -0
  88. package/es/components/eftposPay/mx51/types.js +35 -0
  89. package/es/components/eftposPay/mx51/utils.d.ts +10 -0
  90. package/es/components/eftposPay/mx51/utils.js +121 -0
  91. package/es/components/eftposPay/pay.js +21 -9
  92. package/es/components/eftposPay/payo/config.js +39 -5
  93. package/es/components/eftposPay/payo/const.js +1 -1
  94. package/es/components/eftposPay/payo/hooks.js +3 -12
  95. package/es/components/eftposPay/payo/payment.js +69 -136
  96. package/es/components/eftposPay/store/index.d.ts +5 -9
  97. package/es/components/eftposPay/tip.js +5 -0
  98. package/es/components/eftposPay/tyro/const.js +1 -1
  99. package/es/components/eftposPay/tyro/index.js +44 -11
  100. package/es/components/eftposPay/utils/payLog.d.ts +81 -0
  101. package/es/components/eftposPay/utils/payLog.js +458 -0
  102. package/es/components/eftposPay/windcave/const.js +1 -1
  103. package/es/components/eftposPay/windcave/receiptAction.js +5 -0
  104. package/es/components/eftposPay/windcave/windcave.js +37 -38
  105. package/es/components/ticketBooking/utils/formatProductMessage.js +47 -2
  106. package/lib/components/booking/components/footer/amount.js +3 -3
  107. package/lib/components/booking/components/footer/utils.js +12 -5
  108. package/lib/components/booking/components/voucher/index.js +1 -1
  109. package/lib/components/booking/info2/service/editService/index.js +56 -5
  110. package/lib/components/booking/info2/service/editService/utils.d.ts +1 -0
  111. package/lib/components/booking/info2/service/editService/utils.js +16 -0
  112. package/lib/components/booking/payments/index.js +1 -1
  113. package/lib/components/eftpos/PairModal/hooks.d.ts +27 -0
  114. package/lib/components/eftpos/PairModal/hooks.js +70 -0
  115. package/lib/components/eftpos/PairModal/index.d.ts +11 -0
  116. package/lib/components/eftpos/PairModal/index.js +197 -0
  117. package/lib/components/eftpos/PairModal/index.less +70 -0
  118. package/lib/components/eftpos/SettlementModal/Action.d.ts +7 -0
  119. package/lib/components/eftpos/SettlementModal/Action.js +153 -0
  120. package/lib/components/eftpos/SettlementModal/index.d.ts +7 -0
  121. package/lib/components/eftpos/SettlementModal/index.js +170 -0
  122. package/lib/components/eftpos/SettlementModal/index.less +33 -0
  123. package/lib/components/eftpos/SettlementModal/serve.d.ts +8 -0
  124. package/lib/components/eftpos/SettlementModal/serve.js +45 -0
  125. package/lib/components/eftpos/SettlementModal/types.d.ts +138 -0
  126. package/lib/components/eftpos/SettlementModal/types.js +43 -0
  127. package/lib/components/eftpos/SettlementModal/utils.d.ts +18 -0
  128. package/lib/components/eftpos/SettlementModal/utils.js +248 -0
  129. package/lib/components/eftpos/assets/mx51SCI.svg +15 -0
  130. package/lib/components/eftpos/const.d.ts +3 -1
  131. package/lib/components/eftpos/const.js +2 -0
  132. package/lib/components/eftpos/device.d.ts +3 -1
  133. package/lib/components/eftpos/device.js +13 -3
  134. package/lib/components/eftpos/hooks.d.ts +13 -0
  135. package/lib/components/eftpos/hooks.js +30 -0
  136. package/lib/components/eftpos/index.js +121 -8
  137. package/lib/components/eftpos/index.less +32 -1
  138. package/lib/components/eftpos/locales.d.ts +80 -0
  139. package/lib/components/eftpos/locales.js +231 -21
  140. package/lib/components/eftpos/table.js +30 -2
  141. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
  142. package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
  143. package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.js +171 -0
  144. package/lib/components/eftposPay/aggregatePayment/index.d.ts +2 -1
  145. package/lib/components/eftposPay/aggregatePayment/index.js +5 -2
  146. package/lib/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
  147. package/lib/components/eftposPay/aggregatePayment/mock.js +679 -0
  148. package/lib/components/eftposPay/aggregatePayment/types.d.ts +12 -12
  149. package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
  150. package/lib/components/eftposPay/aggregatePayment/utils/payment.js +173 -123
  151. package/lib/components/eftposPay/amount.js +13 -1
  152. package/lib/components/eftposPay/app.js +4 -5
  153. package/lib/components/eftposPay/component/fail/failCustom.js +10 -2
  154. package/lib/components/eftposPay/component/fail/index.js +10 -2
  155. package/lib/components/eftposPay/component/fail/network.js +3 -0
  156. package/lib/components/eftposPay/component/fail/unknow.js +8 -0
  157. package/lib/components/eftposPay/component/manual/index.js +16 -2
  158. package/lib/components/eftposPay/component/signature/index.js +3 -0
  159. package/lib/components/eftposPay/const.d.ts +8 -3
  160. package/lib/components/eftposPay/const.js +2 -0
  161. package/lib/components/eftposPay/device.js +114 -25
  162. package/lib/components/eftposPay/helper.d.ts +3 -0
  163. package/lib/components/eftposPay/helper.js +2 -1
  164. package/lib/components/eftposPay/hooks.d.ts +1 -1
  165. package/lib/components/eftposPay/index.js +38 -13
  166. package/lib/components/eftposPay/linkly/const.js +1 -1
  167. package/lib/components/eftposPay/linkly/hooks/normal.js +22 -43
  168. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +13 -65
  169. package/lib/components/eftposPay/linkly/index.js +8 -10
  170. package/lib/components/eftposPay/locales.d.ts +15 -0
  171. package/lib/components/eftposPay/locales.js +30 -15
  172. package/lib/components/eftposPay/manufacturer.d.ts +1 -0
  173. package/lib/components/eftposPay/manufacturer.js +6 -0
  174. package/lib/components/eftposPay/mx51/Action.d.ts +6 -0
  175. package/lib/components/eftposPay/mx51/Action.js +154 -0
  176. package/lib/components/eftposPay/mx51/const.d.ts +5 -0
  177. package/lib/components/eftposPay/mx51/const.js +85 -0
  178. package/lib/components/eftposPay/mx51/index.d.ts +6 -0
  179. package/lib/components/eftposPay/mx51/index.js +433 -0
  180. package/lib/components/eftposPay/mx51/types.d.ts +142 -0
  181. package/lib/components/eftposPay/mx51/types.js +43 -0
  182. package/lib/components/eftposPay/mx51/utils.d.ts +10 -0
  183. package/lib/components/eftposPay/mx51/utils.js +115 -0
  184. package/lib/components/eftposPay/pay.js +13 -3
  185. package/lib/components/eftposPay/payo/config.js +16 -8
  186. package/lib/components/eftposPay/payo/const.js +1 -1
  187. package/lib/components/eftposPay/payo/hooks.js +12 -10
  188. package/lib/components/eftposPay/payo/payment.js +31 -65
  189. package/lib/components/eftposPay/store/index.d.ts +5 -9
  190. package/lib/components/eftposPay/tip.js +5 -0
  191. package/lib/components/eftposPay/tyro/const.js +1 -1
  192. package/lib/components/eftposPay/tyro/index.js +21 -17
  193. package/lib/components/eftposPay/utils/payLog.d.ts +81 -0
  194. package/lib/components/eftposPay/utils/payLog.js +321 -0
  195. package/lib/components/eftposPay/windcave/const.js +1 -1
  196. package/lib/components/eftposPay/windcave/receiptAction.js +5 -0
  197. package/lib/components/eftposPay/windcave/windcave.js +27 -29
  198. package/lib/components/ticketBooking/utils/formatProductMessage.js +44 -2
  199. package/package.json +4 -4
  200. package/es/components/eftposPay/utils/log/index.d.ts +0 -110
  201. package/es/components/eftposPay/utils/log/index.js +0 -371
  202. package/lib/components/eftposPay/utils/log/index.d.ts +0 -110
  203. package/lib/components/eftposPay/utils/log/index.js +0 -294
@@ -7,7 +7,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
7
7
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
8
  import { useRef } from 'react';
9
9
  import { PayStatus } from "../const";
10
- import paymentLog from "../utils/log";
10
+ import payLog from "../utils/payLog";
11
11
 
12
12
  /**
13
13
  * 实现支付和查询一体化的接口
@@ -131,9 +131,8 @@ export var usePayment = function usePayment(options) {
131
131
  */
132
132
  var finish = function finish() {
133
133
  if (!isFinishedRef.current) {
134
- clean(); // 先完全清理,包括回调
135
- isFinishedRef.current = true; // 然后标记为已完成(防止重复调用)
136
- paymentLog.clearLogs();
134
+ clean();
135
+ isFinishedRef.current = true;
137
136
  }
138
137
  };
139
138
 
@@ -143,17 +142,14 @@ export var usePayment = function usePayment(options) {
143
142
  var handleFinalSuccess = function handleFinalSuccess(res, type) {
144
143
  var _callbacksRef$current, _callbacksRef$current2;
145
144
  if (isFinishedRef.current || !shouldContinue()) {
146
- console.log("\u26A0\uFE0F \u5DF2\u5B8C\u6210\u6216\u4E0D\u5E94\u7EE7\u7EED\u5904\u7406\uFF0C\u5FFD\u7565".concat(type, "\u64CD\u4F5C\u6210\u529F\u7ED3\u679C"));
145
+ payLog.log("handleFinalSuccess: \u5DF2\u5B8C\u6210\u6216\u4E0D\u5E94\u7EE7\u7EED\u5904\u7406\uFF0C\u5FFD\u7565".concat(type, "\u64CD\u4F5C\u6210\u529F\u7ED3\u679C"));
147
146
  return;
148
147
  }
149
- (_callbacksRef$current = callbacksRef.current) === null || _callbacksRef$current === void 0 || (_callbacksRef$current2 = _callbacksRef$current.onSuccess) === null || _callbacksRef$current2 === void 0 || _callbacksRef$current2.call(_callbacksRef$current, res);
150
- paymentLog.addLog({
151
- title: '最终结果:支付成功',
152
- content: {
153
- type: type,
154
- res: res
155
- }
148
+ payLog.log('接口最终结果:支付成功', {
149
+ type: type,
150
+ res: res
156
151
  });
152
+ (_callbacksRef$current = callbacksRef.current) === null || _callbacksRef$current === void 0 || (_callbacksRef$current2 = _callbacksRef$current.onSuccess) === null || _callbacksRef$current2 === void 0 || _callbacksRef$current2.call(_callbacksRef$current, res);
157
153
  finish();
158
154
  };
159
155
 
@@ -165,17 +161,14 @@ export var usePayment = function usePayment(options) {
165
161
  var handleFinalError = function handleFinalError(error, type) {
166
162
  var _callbacksRef$current3, _callbacksRef$current4;
167
163
  if (isFinishedRef.current || !shouldContinue()) {
168
- console.log("\u26A0\uFE0F \u5DF2\u5B8C\u6210\u6216\u4E0D\u5E94\u7EE7\u7EED\u5904\u7406\uFF0C\u5FFD\u7565".concat(type, "\u64CD\u4F5C\u9519\u8BEF"));
164
+ payLog.log("handleFinalError: \u5DF2\u5B8C\u6210\u6216\u4E0D\u5E94\u7EE7\u7EED\u5904\u7406\uFF0C\u5FFD\u7565".concat(type, "\u64CD\u4F5C\u9519\u8BEF"));
169
165
  return;
170
166
  }
171
- (_callbacksRef$current3 = callbacksRef.current) === null || _callbacksRef$current3 === void 0 || (_callbacksRef$current4 = _callbacksRef$current3.onError) === null || _callbacksRef$current4 === void 0 || _callbacksRef$current4.call(_callbacksRef$current3, error);
172
- paymentLog.addLog({
173
- title: '最终结果:支付失败',
174
- content: {
175
- type: type,
176
- error: error
177
- }
167
+ payLog.log('接口最终结果:支付失败', {
168
+ type: type,
169
+ error: error
178
170
  });
171
+ (_callbacksRef$current3 = callbacksRef.current) === null || _callbacksRef$current3 === void 0 || (_callbacksRef$current4 = _callbacksRef$current3.onError) === null || _callbacksRef$current4 === void 0 || _callbacksRef$current4.call(_callbacksRef$current3, error);
179
172
  finish();
180
173
  };
181
174
 
@@ -185,7 +178,7 @@ export var usePayment = function usePayment(options) {
185
178
  var createTimeoutPromise = function createTimeoutPromise(timeoutMs) {
186
179
  return new Promise(function (_, reject) {
187
180
  requestTimeoutTimerRef.current = setTimeout(function () {
188
- console.log("\u23F1\uFE0F \u5355\u6B21\u67E5\u8BE2\u8D85\u65F6\uFF08".concat(timeoutMs / 1000, "\u79D2\uFF09\uFF0C\u5F3A\u5236\u7EC8\u6B62"));
181
+ payLog.log("\u23F1\uFE0F \u5355\u6B21\u67E5\u8BE2\u8D85\u65F6\uFF08".concat(timeoutMs / 1000, "\u79D2\uFF09\uFF0C\u5F3A\u5236\u7EC8\u6B62"));
189
182
  isRequestTimeoutRef.current = true;
190
183
  // 取消请求
191
184
  if (queryControllerRef.current) {
@@ -209,9 +202,7 @@ export var usePayment = function usePayment(options) {
209
202
  _context.next = 3;
210
203
  break;
211
204
  }
212
- paymentLog.addLog({
213
- title: '支付轮询前置校验:支付已完成或不应继续处理,取消查询'
214
- });
205
+ payLog.log('支付轮询前置校验:已完成或不应继续,取消查询');
215
206
  return _context.abrupt("return");
216
207
  case 3:
217
208
  // 清理之前的查询控制器和超时定时器
@@ -235,9 +226,7 @@ export var usePayment = function usePayment(options) {
235
226
  queryControllerRef.current = new AbortController();
236
227
  signal = queryControllerRef.current.signal;
237
228
  _context.prev = 10;
238
- paymentLog.addLog({
239
- title: '支付轮询:开始单次查询'
240
- });
229
+ payLog.log('支付轮询:开始单次查询');
241
230
  // 使用 Promise.race 确保超时控制可靠
242
231
  _context.next = 14;
243
232
  return Promise.race([checkApi({
@@ -258,42 +247,34 @@ export var usePayment = function usePayment(options) {
258
247
  _context.next = 19;
259
248
  break;
260
249
  }
261
- paymentLog.addLog({
262
- title: '支付轮询结果:过期的查询响应,忽略'
263
- });
250
+ payLog.log('支付轮询结果:过期的查询响应,忽略');
264
251
  return _context.abrupt("return");
265
252
  case 19:
266
253
  if (!(isFinishedRef.current || !shouldContinue())) {
267
254
  _context.next = 22;
268
255
  break;
269
256
  }
270
- paymentLog.addLog({
271
- title: '支付轮询结果:支付已完成或不应继续处理'
272
- });
257
+ payLog.log('支付轮询结果:已完成或不应继续处理');
273
258
  return _context.abrupt("return");
274
259
  case 22:
275
260
  if (!(_res && "".concat(_res.code) === '200')) {
276
261
  _context.next = 26;
277
262
  break;
278
263
  }
279
- paymentLog.addLog({
280
- title: '支付轮询结果:支付成功'
281
- });
264
+ payLog.log('支付轮询结果:支付成功');
282
265
  handleFinalSuccess(_res, ActionType.Query);
283
266
  return _context.abrupt("return");
284
267
  case 26:
285
268
  // 查询返回失败但没有明确code或超时code,继续轮询
286
269
  if (isRequestFailed(_res === null || _res === void 0 ? void 0 : _res.code)) {
287
270
  // 有明确错误code,停止轮询
288
- paymentLog.addLog({
289
- title: '支付轮询结果:有明确错误code,停止轮询',
290
- content: _res
271
+ payLog.log('支付轮询结果:有明确错误code,停止轮询', {
272
+ code: _res === null || _res === void 0 ? void 0 : _res.code
291
273
  });
292
274
  handleFinalError(_res, ActionType.Query);
293
275
  } else {
294
- paymentLog.addLog({
295
- title: '支付轮询结果:查询返回失败但没有明确code或超时code,继续轮询',
296
- content: _res
276
+ payLog.log('支付轮询结果:无明确code,继续轮询', {
277
+ code: _res === null || _res === void 0 ? void 0 : _res.code
297
278
  });
298
279
  scheduleNextQuery(paymentNum);
299
280
  }
@@ -307,15 +288,11 @@ export var usePayment = function usePayment(options) {
307
288
  clearTimeout(requestTimeoutTimerRef.current);
308
289
  requestTimeoutTimerRef.current = null;
309
290
  }
310
-
311
- // 检查是否是过期的响应(新查询的 ID 一定大于旧查询)
312
291
  if (!(queryId < currentQueryIdRef.current)) {
313
292
  _context.next = 35;
314
293
  break;
315
294
  }
316
- paymentLog.addLog({
317
- title: '支付轮询结果:error-过期的查询异常,忽略'
318
- });
295
+ payLog.log('支付轮询结果:error-过期的查询异常,忽略');
319
296
  return _context.abrupt("return");
320
297
  case 35:
321
298
  if (!(isFinishedRef.current || !shouldContinue())) {
@@ -328,24 +305,20 @@ export var usePayment = function usePayment(options) {
328
305
  _context.next = 41;
329
306
  break;
330
307
  }
331
- paymentLog.addLog({
332
- title: '支付轮询结果:error-请求被取消或超时,继续轮询'
333
- });
308
+ payLog.log('支付轮询结果:error-请求被取消或超时,继续轮询');
334
309
  // 注意:这里不增加 queryId,因为 scheduleNextQuery → performQuery 会生成新的 ID
335
310
  scheduleNextQuery(paymentNum);
336
311
  return _context.abrupt("return");
337
312
  case 41:
338
313
  // 无明确code或者code是超时或支付超时,继续轮询
339
314
  if (isRequestFailed(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.code)) {
340
- paymentLog.addLog({
341
- title: '支付轮询结果:error-有明确错误code,停止轮询',
342
- content: _context.t0
315
+ payLog.log('支付轮询结果:error-有明确错误code,停止轮询', {
316
+ code: _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.code
343
317
  });
344
318
  handleFinalError(_context.t0, ActionType.Query);
345
319
  } else {
346
- paymentLog.addLog({
347
- title: '支付轮询结果:error-无明确code或者code不是超时,继续轮询',
348
- content: _context.t0
320
+ payLog.log('支付轮询结果:error-无明确code,继续轮询', {
321
+ code: _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.code
349
322
  });
350
323
  scheduleNextQuery(paymentNum);
351
324
  }
@@ -371,9 +344,7 @@ export var usePayment = function usePayment(options) {
371
344
  clearTimeout(queryIntervalTimerRef.current);
372
345
  }
373
346
  queryIntervalTimerRef.current = setTimeout(function () {
374
- paymentLog.addLog({
375
- title: '支付轮询:安排下一次查询'
376
- });
347
+ payLog.log('支付轮询:安排下一次查询');
377
348
  performQuery(paymentNum);
378
349
  }, QUERY_INTERVAL);
379
350
  };
@@ -393,9 +364,7 @@ export var usePayment = function usePayment(options) {
393
364
  return;
394
365
  }
395
366
  console.log('⏱️ 轮询全局超时(2分钟),终止所有请求');
396
- paymentLog.addLog({
397
- title: '轮询全局超时(2分钟),终止所有请求'
398
- });
367
+ payLog.log('轮询全局超时(2分钟),终止所有请求');
399
368
  handleFinalError({
400
369
  code: PayStatus.Timeout,
401
370
  message: '交易超时'
@@ -416,15 +385,7 @@ export var usePayment = function usePayment(options) {
416
385
  _options$paymentType = options.paymentType, paymentType = _options$paymentType === void 0 ? ActionType.Pay : _options$paymentType, params = options.params, paymentNum = options.paymentNum, callbacks = options.callbacks; // 生成本次执行的唯一ID(使用时间戳)
417
386
  runId = Date.now();
418
387
  currentRunIdRef.current = runId;
419
- _ref4 = params || {}, pay_param_base64 = _ref4.pay_param_base64, otherParams = _objectWithoutProperties(_ref4, _excluded);
420
- paymentLog.init(paymentNum, {
421
- orderId: options === null || options === void 0 ? void 0 : options.orderId,
422
- deviceId: options === null || options === void 0 ? void 0 : options.deviceId,
423
- paymentType: "PAYO_".concat(paymentType),
424
- params: otherParams
425
- });
426
-
427
- // 先标记为已完成,阻止旧的请求响应被处理
388
+ _ref4 = params || {}, pay_param_base64 = _ref4.pay_param_base64, otherParams = _objectWithoutProperties(_ref4, _excluded); // 先标记为已完成,阻止旧的请求响应被处理
428
389
  isFinishedRef.current = true;
429
390
 
430
391
  // 清理资源但保留回调引用(会把 isFinishedRef 重置为 false)
@@ -437,124 +398,98 @@ export var usePayment = function usePayment(options) {
437
398
 
438
399
  // 10秒后开始轮询(全局超时将在开始轮询时启动)
439
400
  queryStartTimerRef.current = setTimeout(function () {
440
- paymentLog.addLog({
441
- title: '支付后10秒开始轮询'
442
- });
401
+ payLog.log('支付后10秒开始轮询');
443
402
  startQuery(paymentNum);
444
403
  }, QUERY_START_DELAY);
445
404
 
446
405
  // 创建支付请求控制器
447
406
  payControllerRef.current = new AbortController();
448
407
  signal = payControllerRef.current.signal;
449
- _context2.prev = 11;
450
- paymentLog.addLog({
451
- title: '发起支付请求'
452
- });
408
+ _context2.prev = 10;
409
+ payLog.log('发起支付请求');
453
410
  resultPromise = paymentType === ActionType.Pay ? payApi : refundApi;
454
411
  if (resultPromise) {
455
- _context2.next = 16;
412
+ _context2.next = 15;
456
413
  break;
457
414
  }
458
415
  throw new Error("".concat(paymentType === ActionType.Pay ? '支付' : '退款', "\u63A5\u53E3\u4E0D\u5B58\u5728"));
459
- case 16:
460
- _context2.next = 18;
416
+ case 15:
417
+ _context2.next = 17;
461
418
  return resultPromise === null || resultPromise === void 0 ? void 0 : resultPromise(params, {
462
419
  signal: signal
463
420
  });
464
- case 18:
421
+ case 17:
465
422
  _res2 = _context2.sent;
466
423
  if (!(runId < currentRunIdRef.current)) {
467
- _context2.next = 22;
424
+ _context2.next = 21;
468
425
  break;
469
426
  }
470
- paymentLog.addLog({
471
- title: '支付响应过期,忽略'
472
- });
427
+ payLog.log('支付响应过期,忽略');
473
428
  return _context2.abrupt("return");
474
- case 22:
429
+ case 21:
475
430
  if (!(isFinishedRef.current || !shouldContinue())) {
476
- _context2.next = 25;
431
+ _context2.next = 24;
477
432
  break;
478
433
  }
479
- paymentLog.addLog({
480
- title: '支付返回时已完成或不应继续处理'
481
- });
434
+ payLog.log('支付返回时已完成或不应继续处理');
482
435
  return _context2.abrupt("return");
483
- case 25:
436
+ case 24:
484
437
  if (!(_res2 && "".concat(_res2.code) === '200')) {
485
- _context2.next = 29;
438
+ _context2.next = 28;
486
439
  break;
487
440
  }
488
- paymentLog.addLog({
489
- title: '支付接口成功'
490
- });
441
+ payLog.log('支付接口成功');
491
442
  handleFinalSuccess(_res2, paymentType);
492
443
  return _context2.abrupt("return");
493
- case 29:
444
+ case 28:
494
445
  // 支付接口返回失败
495
446
  // 如果有明确的错误code且不是超时,则直接失败
496
447
  if (isRequestFailed(_res2 === null || _res2 === void 0 ? void 0 : _res2.code)) {
497
- paymentLog.addLog({
498
- title: '支付接口返回失败',
499
- content: {
500
- res: _res2
501
- }
448
+ payLog.log('支付接口返回失败', {
449
+ code: _res2 === null || _res2 === void 0 ? void 0 : _res2.code
502
450
  });
503
451
  handleFinalError(_res2, ActionType.Pay);
504
452
  } else {
505
- paymentLog.addLog({
506
- title: '支付超时或无明确错误,等待轮询结果',
507
- content: {
508
- res: _res2
509
- }
453
+ payLog.log('支付超时或无明确错误,等待轮询结果', {
454
+ code: _res2 === null || _res2 === void 0 ? void 0 : _res2.code
510
455
  });
511
456
  }
512
- _context2.next = 41;
457
+ _context2.next = 40;
513
458
  break;
514
- case 32:
515
- _context2.prev = 32;
516
- _context2.t0 = _context2["catch"](11);
459
+ case 31:
460
+ _context2.prev = 31;
461
+ _context2.t0 = _context2["catch"](10);
517
462
  if (!(runId < currentRunIdRef.current)) {
518
- _context2.next = 37;
463
+ _context2.next = 36;
519
464
  break;
520
465
  }
521
- paymentLog.addLog({
522
- title: '支付响应过期,忽略'
523
- });
466
+ payLog.log('支付异常响应过期,忽略');
524
467
  return _context2.abrupt("return");
525
- case 37:
468
+ case 36:
526
469
  if (!(isFinishedRef.current || !shouldContinue())) {
527
- _context2.next = 40;
470
+ _context2.next = 39;
528
471
  break;
529
472
  }
530
- paymentLog.addLog({
531
- title: '支付异常时已完成或不应继续处理'
532
- });
473
+ payLog.log('支付异常时已完成或不应继续处理');
533
474
  return _context2.abrupt("return");
534
- case 40:
475
+ case 39:
535
476
  // 支付接口异常
536
477
  // 如果有明确的错误code且不是超时,则直接失败
537
478
  if (isRequestFailed(_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code)) {
538
- paymentLog.addLog({
539
- title: '支付接口异常',
540
- content: {
541
- error: _context2.t0
542
- }
479
+ payLog.log('支付接口异常', {
480
+ code: _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code
543
481
  });
544
482
  handleFinalError(_context2.t0, paymentType);
545
483
  } else {
546
- paymentLog.addLog({
547
- title: '支付超时或无明确错误,等待轮询结果',
548
- content: {
549
- error: _context2.t0
550
- }
484
+ payLog.log('支付异常超时或无明确错误,等待轮询结果', {
485
+ code: _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.code
551
486
  });
552
487
  }
553
- case 41:
488
+ case 40:
554
489
  case "end":
555
490
  return _context2.stop();
556
491
  }
557
- }, _callee2, null, [[11, 32]]);
492
+ }, _callee2, null, [[10, 31]]);
558
493
  }));
559
494
  return function run(_x2) {
560
495
  return _ref3.apply(this, arguments);
@@ -565,9 +500,7 @@ export var usePayment = function usePayment(options) {
565
500
  * 手动停止(完全清理,包括回调)
566
501
  */
567
502
  var stop = function stop() {
568
- paymentLog.addLog({
569
- title: '手动停止支付流程'
570
- });
503
+ payLog.log('手动停止支付流程');
571
504
  clean(); // 完全清理,包括回调
572
505
  isFinishedRef.current = true; // 标记为已完成
573
506
  };
@@ -91,10 +91,8 @@ export declare type State = {
91
91
  };
92
92
  backup?: Omit<State, 'backup'>;
93
93
  client: ClientEnum;
94
- /** 原始参数 - 用于 retry 时完整恢复 */
95
- originalParams?: {
96
- [key: string]: unknown;
97
- };
94
+ /** 支付原始参数 */
95
+ originalParams?: Record<string, any>;
98
96
  };
99
97
  export declare type Action = {
100
98
  type: EActionTypes;
@@ -301,8 +299,8 @@ export declare const backUpFree: (payload: Partial<State>) => {
301
299
  amount?: string | number | undefined;
302
300
  mode?: "pay" | "refund" | "fullPay" | "query" | undefined;
303
301
  order_id?: string | number | undefined;
304
- eftpos?: "stripe" | "tyro" | "windcave" | "payo" | "linkly" | "huifu" | undefined;
305
- action?: "amount" | "pay" | "deviceList" | undefined;
302
+ eftpos?: "stripe" | "tyro" | "mx51" | "payo" | "windcave" | "linkly" | "huifu" | undefined;
303
+ action?: "pay" | "amount" | "deviceList" | undefined;
306
304
  key?: number | undefined;
307
305
  step?: number | undefined;
308
306
  title?: string | undefined;
@@ -348,9 +346,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
348
346
  } | undefined;
349
347
  backup?: Omit<State, "backup"> | undefined;
350
348
  client?: ClientEnum | undefined;
351
- originalParams?: {
352
- [key: string]: unknown;
353
- } | undefined;
349
+ originalParams?: Record<string, any> | undefined;
354
350
  };
355
351
  };
356
352
  export declare function reducers(state: State, action: Action): State;
@@ -19,6 +19,7 @@ import { RestoreEumn, EftposEnum } from "./const";
19
19
  import dayjs from 'dayjs';
20
20
  import { useDispatch, useContextData, updateState, updateCustom, updateNextStep } from "./store";
21
21
  import { useStoreRef } from "./hooks";
22
+ import payLog from "./utils/payLog";
22
23
  import "./tip.less";
23
24
  function formatDateUtils(date, format) {
24
25
  if (!date) {
@@ -90,7 +91,11 @@ export default (function (_ref) {
90
91
  modeRef = _useStoreRef.modeRef,
91
92
  amountRef = _useStoreRef.amountRef,
92
93
  eftposRef = _useStoreRef.eftposRef;
94
+ useEffect(function () {
95
+ payLog.log('成功确认页展示');
96
+ }, []);
93
97
  var onConfirm = function onConfirm() {
98
+ payLog.log('确认支付成功');
94
99
  onChangeStatus('success', _objectSpread({}, ref.current || {}));
95
100
  };
96
101
 
@@ -45,7 +45,7 @@ export default (function (params) {
45
45
  status: StatusEnum.Loading,
46
46
  steps: [],
47
47
  render: true,
48
- client: client !== 'undefined' ? client : ClientEnum.Merchant,
48
+ client: client !== 'undefined' && client !== undefined ? client : ClientEnum.Merchant,
49
49
  custom: other || {}
50
50
  }, typeof net !== 'undefined' ? {
51
51
  net: net
@@ -24,6 +24,7 @@ import { Decimal } from 'decimal.js';
24
24
  import { getUuid, getPayParams, getBrowserVersion } from "../helper";
25
25
  import Step from "../component/step/step";
26
26
  import { useStoreRef } from "../hooks";
27
+ import payLog from "../utils/payLog";
27
28
  var Minute = 1000 * 60;
28
29
  export default (function (_ref) {
29
30
  var api = _ref.api,
@@ -116,6 +117,11 @@ export default (function (_ref) {
116
117
  var status = _ref2.status,
117
118
  message = _ref2.message,
118
119
  terminalInfo = _ref2.terminalInfo;
120
+ payLog.log('Tyro:终端信息回调', {
121
+ status: status,
122
+ terminalInfo: terminalInfo,
123
+ message: message
124
+ });
119
125
  if (status === 'success' && terminalInfo !== null && terminalInfo !== void 0 && terminalInfo.available) {
120
126
  cb();
121
127
  }
@@ -133,7 +139,7 @@ export default (function (_ref) {
133
139
  * @Date: 2024-08-19 11:32
134
140
  */
135
141
  var refundOrder = function refundOrder() {
136
- var _deviceRef$current3, _deviceRef$current4;
142
+ var _deviceRef$current3, _deviceRef$current4, _requestParams$curren;
137
143
  var iClient = iClientRef.current;
138
144
  if (!iClient) {
139
145
  return;
@@ -193,6 +199,13 @@ export default (function (_ref) {
193
199
  requestId: res.data.id
194
200
  }));
195
201
  });
202
+ payLog.setContext({
203
+ transactionNumber: numRef.current
204
+ });
205
+ payLog.log('Tyro:发起退款', {
206
+ number: numRef === null || numRef === void 0 ? void 0 : numRef.current,
207
+ amount: (_requestParams$curren = requestParams.current) === null || _requestParams$curren === void 0 ? void 0 : _requestParams$curren.amount
208
+ });
196
209
  iClient.initiateRefund(requestParams.current, {
197
210
  receiptCallback: receiptCallbackImpl,
198
211
  transactionCompleteCallback: transactionCompleteCallbackImpl,
@@ -273,6 +286,13 @@ export default (function (_ref) {
273
286
  requestId: res.data.id
274
287
  }));
275
288
  });
289
+ payLog.setContext({
290
+ transactionNumber: numRef.current
291
+ });
292
+ payLog.log('Tyro:发起支付', {
293
+ number: numRef.current,
294
+ amount: requestParams.current.amount
295
+ });
276
296
  iClient.initiatePurchase(requestParams.current, {
277
297
  receiptCallback: receiptCallbackImpl,
278
298
  transactionCompleteCallback: transactionCompleteCallbackImpl,
@@ -296,7 +316,7 @@ export default (function (_ref) {
296
316
  }
297
317
  setStatus(Date.now());
298
318
  merchantReceiptRef.current = {};
299
- // 恢复 记录
319
+ payLog.log('Tyro:恢复上次交易');
300
320
  iClient.continueLastTransaction({
301
321
  receiptCallback: receiptCallbackImpl,
302
322
  transactionCompleteCallback: transactionCompleteCallbackImpl,
@@ -315,8 +335,10 @@ export default (function (_ref) {
315
335
  var receiptCallbackImpl = function receiptCallbackImpl(_ref3) {
316
336
  var signatureRequired = _ref3.signatureRequired,
317
337
  merchantReceipt = _ref3.merchantReceipt;
318
- console.log('商家小票 客户端是否打印小票 = ', signatureRequired);
319
- console.log('商家小票 小票内容 = \n', merchantReceipt);
338
+ payLog.log('Tyro:小票回调', {
339
+ signatureRequired: signatureRequired,
340
+ hasReceipt: !!merchantReceipt
341
+ });
320
342
  var receipt = [merchantReceipt].filter(function (item) {
321
343
  return typeof item === 'string';
322
344
  }).filter(Boolean);
@@ -343,6 +365,9 @@ export default (function (_ref) {
343
365
  */
344
366
  var statusMessageCallbackImpl = function statusMessageCallbackImpl(message) {
345
367
  var _listRef$current;
368
+ payLog.log('Tyro:状态消息', {
369
+ message: message
370
+ });
346
371
  var translateMsg = locales.getText('page.eftpos-pay.text.tyro')(message);
347
372
  var msg = Array.isArray(translateMsg) ? translateMsg.reduce(function (accumulator, currentValue) {
348
373
  return accumulator + ' ' + currentValue;
@@ -371,7 +396,9 @@ export default (function (_ref) {
371
396
  * @Date: 2024-08-19 11:34
372
397
  */
373
398
  var questionCallbackImpl = function questionCallbackImpl(question, answerCallback) {
374
- console.log('Question is ' + JSON.stringify(question));
399
+ payLog.log('Tyro:交互问题回调', {
400
+ question: question
401
+ });
375
402
  setStatus(-1);
376
403
  setManually(false);
377
404
  var msg = locales.getText('page.eftpos-pay.text.tyro')(question.text);
@@ -418,8 +445,9 @@ export default (function (_ref) {
418
445
  var _deviceRef$current9;
419
446
  setStatus(-1);
420
447
  setManually(false);
421
- console.log('Response = ' + JSON.stringify(response), ', Request = ', JSON.stringify(requestParams.current));
422
- console.log(' 客户小票 response.customerReceipt = \n', response.customerReceipt);
448
+ payLog.log('Tyro:交易完成回调', {
449
+ response: response
450
+ });
423
451
  var receipt = [// merchantReceiptRef.current?.merchantReceipt,
424
452
  response === null || response === void 0 ? void 0 : response.customerReceipt].filter(function (item) {
425
453
  return typeof item === 'string';
@@ -516,20 +544,22 @@ export default (function (_ref) {
516
544
  if (load && TyroRef.current) {
517
545
  var _IClient = TyroRef.current.IClient;
518
546
  if (_IClient) {
519
- console.log('apiKey = ', apiKey, 'posProductData = ', posProductData);
520
547
  var iclient = new _IClient(apiKey, posProductData);
521
- console.log(iclient.posProductData);
522
548
  iClientRef.current = iclient;
549
+ payLog.log('Tyro:SDK 初始化完成');
523
550
  if (isCancelRef.current) {
524
551
  return;
525
552
  }
526
553
  if (!numRef.current) {
527
554
  if (modeRef.current === ModeEnum.Pay || modeRef.current === ModeEnum.FullPay) {
555
+ payLog.log('Tyro:支付交易,查询终端信息');
528
556
  getTerminalInfo(payOrder);
529
557
  } else if (modeRef.current === ModeEnum.Refund) {
558
+ payLog.log('Tyro:退款交易,查询终端信息');
530
559
  getTerminalInfo(refundOrder);
531
560
  }
532
561
  } else {
562
+ payLog.log('Tyro:恢复上次交易,查询终端信息');
533
563
  getTerminalInfo(continueLastOrder);
534
564
  }
535
565
  }
@@ -548,8 +578,8 @@ export default (function (_ref) {
548
578
  };
549
579
  }
550
580
  if (status === 0) {
551
- console.log('开始倒计时...');
552
581
  clear = setTimeout(function () {
582
+ payLog.log('Tyro:连接超时');
553
583
  dispatch(updateState({
554
584
  status: 'fail'
555
585
  }));
@@ -574,7 +604,7 @@ export default (function (_ref) {
574
604
  if (!iClient) {
575
605
  return;
576
606
  }
577
- console.log('倒计时到了');
607
+ payLog.log('Tyro:交易超时,显示手动标记');
578
608
  setManually(true);
579
609
  }, Minute);
580
610
  return function () {
@@ -584,6 +614,7 @@ export default (function (_ref) {
584
614
  };
585
615
  }, [status]);
586
616
  var onManually = function onManually() {
617
+ payLog.log('Tyro:点击手动标记');
587
618
  dispatch(updateState({
588
619
  manual: {
589
620
  title: locales.getText('page.eftpos-pay.text.request.title')(mode),
@@ -606,12 +637,14 @@ export default (function (_ref) {
606
637
  return;
607
638
  }
608
639
  if (status > 0) {
640
+ payLog.log('Tyro:取消当前交易');
609
641
  iClient.cancelCurrentTransaction();
610
642
  return;
611
643
  }
612
644
  if (isCancelRef.current) {
613
645
  return;
614
646
  }
647
+ payLog.log('Tyro:取消(交易未开始)');
615
648
  isCancelRef.current = true;
616
649
  dispatch(updateState({
617
650
  status: 'fail'