@pisell/private-materials 6.6.62 → 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 +8 -8
  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/checkout/hooks/useWalletPass.d.ts +1 -1
  19. package/es/components/eftpos/PairModal/hooks.d.ts +27 -0
  20. package/es/components/eftpos/PairModal/hooks.js +67 -0
  21. package/es/components/eftpos/PairModal/index.d.ts +11 -0
  22. package/es/components/eftpos/PairModal/index.js +246 -0
  23. package/es/components/eftpos/PairModal/index.less +70 -0
  24. package/es/components/eftpos/SettlementModal/Action.d.ts +7 -0
  25. package/es/components/eftpos/SettlementModal/Action.js +141 -0
  26. package/es/components/eftpos/SettlementModal/index.d.ts +7 -0
  27. package/es/components/eftpos/SettlementModal/index.js +135 -0
  28. package/es/components/eftpos/SettlementModal/index.less +33 -0
  29. package/es/components/eftpos/SettlementModal/serve.d.ts +8 -0
  30. package/es/components/eftpos/SettlementModal/serve.js +171 -0
  31. package/es/components/eftpos/SettlementModal/types.d.ts +138 -0
  32. package/es/components/eftpos/SettlementModal/types.js +35 -0
  33. package/es/components/eftpos/SettlementModal/utils.d.ts +18 -0
  34. package/es/components/eftpos/SettlementModal/utils.js +351 -0
  35. package/es/components/eftpos/assets/mx51SCI.svg +15 -0
  36. package/es/components/eftpos/const.d.ts +3 -1
  37. package/es/components/eftpos/const.js +2 -0
  38. package/es/components/eftpos/device.d.ts +3 -1
  39. package/es/components/eftpos/device.js +14 -3
  40. package/es/components/eftpos/hooks.d.ts +13 -0
  41. package/es/components/eftpos/hooks.js +35 -0
  42. package/es/components/eftpos/index.js +198 -24
  43. package/es/components/eftpos/index.less +32 -1
  44. package/es/components/eftpos/locales.d.ts +80 -0
  45. package/es/components/eftpos/locales.js +205 -25
  46. package/es/components/eftpos/table.js +47 -3
  47. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
  48. package/es/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
  49. package/es/components/eftposPay/aggregatePayment/hooks/usePayment.js +145 -0
  50. package/es/components/eftposPay/aggregatePayment/index.d.ts +2 -1
  51. package/es/components/eftposPay/aggregatePayment/index.js +2 -1
  52. package/es/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
  53. package/es/components/eftposPay/aggregatePayment/mock.js +567 -0
  54. package/es/components/eftposPay/aggregatePayment/service.js +1 -0
  55. package/es/components/eftposPay/aggregatePayment/types.d.ts +12 -12
  56. package/es/components/eftposPay/aggregatePayment/types.js +4 -8
  57. package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
  58. package/es/components/eftposPay/aggregatePayment/utils/payment.js +231 -168
  59. package/es/components/eftposPay/amount.js +15 -1
  60. package/es/components/eftposPay/app.js +2 -3
  61. package/es/components/eftposPay/component/fail/failCustom.js +13 -4
  62. package/es/components/eftposPay/component/fail/index.js +12 -5
  63. package/es/components/eftposPay/component/fail/network.js +3 -0
  64. package/es/components/eftposPay/component/fail/unknow.js +8 -0
  65. package/es/components/eftposPay/component/manual/index.js +17 -3
  66. package/es/components/eftposPay/component/signature/index.js +3 -0
  67. package/es/components/eftposPay/const.d.ts +8 -3
  68. package/es/components/eftposPay/const.js +2 -0
  69. package/es/components/eftposPay/device.js +225 -38
  70. package/es/components/eftposPay/helper.d.ts +3 -0
  71. package/es/components/eftposPay/helper.js +2 -1
  72. package/es/components/eftposPay/hooks.d.ts +1 -1
  73. package/es/components/eftposPay/index.js +50 -13
  74. package/es/components/eftposPay/linkly/const.js +1 -1
  75. package/es/components/eftposPay/linkly/hooks/normal.js +21 -68
  76. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +20 -81
  77. package/es/components/eftposPay/linkly/index.js +11 -23
  78. package/es/components/eftposPay/locales.d.ts +15 -0
  79. package/es/components/eftposPay/locales.js +30 -15
  80. package/es/components/eftposPay/manufacturer.d.ts +1 -0
  81. package/es/components/eftposPay/manufacturer.js +4 -0
  82. package/es/components/eftposPay/mx51/Action.d.ts +6 -0
  83. package/es/components/eftposPay/mx51/Action.js +144 -0
  84. package/es/components/eftposPay/mx51/const.d.ts +5 -0
  85. package/es/components/eftposPay/mx51/const.js +69 -0
  86. package/es/components/eftposPay/mx51/index.d.ts +6 -0
  87. package/es/components/eftposPay/mx51/index.js +498 -0
  88. package/es/components/eftposPay/mx51/types.d.ts +142 -0
  89. package/es/components/eftposPay/mx51/types.js +35 -0
  90. package/es/components/eftposPay/mx51/utils.d.ts +10 -0
  91. package/es/components/eftposPay/mx51/utils.js +121 -0
  92. package/es/components/eftposPay/pay.js +21 -9
  93. package/es/components/eftposPay/payo/config.js +39 -5
  94. package/es/components/eftposPay/payo/const.js +1 -1
  95. package/es/components/eftposPay/payo/hooks.js +3 -12
  96. package/es/components/eftposPay/payo/payment.js +69 -136
  97. package/es/components/eftposPay/store/index.d.ts +4 -8
  98. package/es/components/eftposPay/tip.js +5 -0
  99. package/es/components/eftposPay/tyro/const.js +1 -1
  100. package/es/components/eftposPay/tyro/index.js +44 -11
  101. package/es/components/eftposPay/utils/payLog.d.ts +81 -0
  102. package/es/components/eftposPay/utils/payLog.js +458 -0
  103. package/es/components/eftposPay/windcave/const.js +1 -1
  104. package/es/components/eftposPay/windcave/receiptAction.js +5 -0
  105. package/es/components/eftposPay/windcave/windcave.js +37 -38
  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/checkout/hooks/useWalletPass.d.ts +1 -1
  114. package/lib/components/eftpos/PairModal/hooks.d.ts +27 -0
  115. package/lib/components/eftpos/PairModal/hooks.js +70 -0
  116. package/lib/components/eftpos/PairModal/index.d.ts +11 -0
  117. package/lib/components/eftpos/PairModal/index.js +197 -0
  118. package/lib/components/eftpos/PairModal/index.less +70 -0
  119. package/lib/components/eftpos/SettlementModal/Action.d.ts +7 -0
  120. package/lib/components/eftpos/SettlementModal/Action.js +153 -0
  121. package/lib/components/eftpos/SettlementModal/index.d.ts +7 -0
  122. package/lib/components/eftpos/SettlementModal/index.js +170 -0
  123. package/lib/components/eftpos/SettlementModal/index.less +33 -0
  124. package/lib/components/eftpos/SettlementModal/serve.d.ts +8 -0
  125. package/lib/components/eftpos/SettlementModal/serve.js +45 -0
  126. package/lib/components/eftpos/SettlementModal/types.d.ts +138 -0
  127. package/lib/components/eftpos/SettlementModal/types.js +43 -0
  128. package/lib/components/eftpos/SettlementModal/utils.d.ts +18 -0
  129. package/lib/components/eftpos/SettlementModal/utils.js +248 -0
  130. package/lib/components/eftpos/assets/mx51SCI.svg +15 -0
  131. package/lib/components/eftpos/const.d.ts +3 -1
  132. package/lib/components/eftpos/const.js +2 -0
  133. package/lib/components/eftpos/device.d.ts +3 -1
  134. package/lib/components/eftpos/device.js +13 -3
  135. package/lib/components/eftpos/hooks.d.ts +13 -0
  136. package/lib/components/eftpos/hooks.js +30 -0
  137. package/lib/components/eftpos/index.js +121 -8
  138. package/lib/components/eftpos/index.less +32 -1
  139. package/lib/components/eftpos/locales.d.ts +80 -0
  140. package/lib/components/eftpos/locales.js +231 -21
  141. package/lib/components/eftpos/table.js +30 -2
  142. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
  143. package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
  144. package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.js +171 -0
  145. package/lib/components/eftposPay/aggregatePayment/index.d.ts +2 -1
  146. package/lib/components/eftposPay/aggregatePayment/index.js +5 -2
  147. package/lib/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
  148. package/lib/components/eftposPay/aggregatePayment/mock.js +679 -0
  149. package/lib/components/eftposPay/aggregatePayment/types.d.ts +12 -12
  150. package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
  151. package/lib/components/eftposPay/aggregatePayment/utils/payment.js +173 -123
  152. package/lib/components/eftposPay/amount.js +13 -1
  153. package/lib/components/eftposPay/app.js +4 -5
  154. package/lib/components/eftposPay/component/fail/failCustom.js +10 -2
  155. package/lib/components/eftposPay/component/fail/index.js +10 -2
  156. package/lib/components/eftposPay/component/fail/network.js +3 -0
  157. package/lib/components/eftposPay/component/fail/unknow.js +8 -0
  158. package/lib/components/eftposPay/component/manual/index.js +16 -2
  159. package/lib/components/eftposPay/component/signature/index.js +3 -0
  160. package/lib/components/eftposPay/const.d.ts +8 -3
  161. package/lib/components/eftposPay/const.js +2 -0
  162. package/lib/components/eftposPay/device.js +114 -25
  163. package/lib/components/eftposPay/helper.d.ts +3 -0
  164. package/lib/components/eftposPay/helper.js +2 -1
  165. package/lib/components/eftposPay/hooks.d.ts +1 -1
  166. package/lib/components/eftposPay/index.js +38 -13
  167. package/lib/components/eftposPay/linkly/const.js +1 -1
  168. package/lib/components/eftposPay/linkly/hooks/normal.js +22 -43
  169. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +13 -65
  170. package/lib/components/eftposPay/linkly/index.js +8 -10
  171. package/lib/components/eftposPay/locales.d.ts +15 -0
  172. package/lib/components/eftposPay/locales.js +30 -15
  173. package/lib/components/eftposPay/manufacturer.d.ts +1 -0
  174. package/lib/components/eftposPay/manufacturer.js +6 -0
  175. package/lib/components/eftposPay/mx51/Action.d.ts +6 -0
  176. package/lib/components/eftposPay/mx51/Action.js +154 -0
  177. package/lib/components/eftposPay/mx51/const.d.ts +5 -0
  178. package/lib/components/eftposPay/mx51/const.js +85 -0
  179. package/lib/components/eftposPay/mx51/index.d.ts +6 -0
  180. package/lib/components/eftposPay/mx51/index.js +433 -0
  181. package/lib/components/eftposPay/mx51/types.d.ts +142 -0
  182. package/lib/components/eftposPay/mx51/types.js +43 -0
  183. package/lib/components/eftposPay/mx51/utils.d.ts +10 -0
  184. package/lib/components/eftposPay/mx51/utils.js +115 -0
  185. package/lib/components/eftposPay/pay.js +13 -3
  186. package/lib/components/eftposPay/payo/config.js +16 -8
  187. package/lib/components/eftposPay/payo/const.js +1 -1
  188. package/lib/components/eftposPay/payo/hooks.js +12 -10
  189. package/lib/components/eftposPay/payo/payment.js +31 -65
  190. package/lib/components/eftposPay/store/index.d.ts +4 -8
  191. package/lib/components/eftposPay/tip.js +5 -0
  192. package/lib/components/eftposPay/tyro/const.js +1 -1
  193. package/lib/components/eftposPay/tyro/index.js +21 -17
  194. package/lib/components/eftposPay/utils/payLog.d.ts +81 -0
  195. package/lib/components/eftposPay/utils/payLog.js +321 -0
  196. package/lib/components/eftposPay/windcave/const.js +1 -1
  197. package/lib/components/eftposPay/windcave/receiptAction.js +5 -0
  198. package/lib/components/eftposPay/windcave/windcave.js +27 -29
  199. package/package.json +2 -2
  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
@@ -43,19 +43,30 @@ var import_manufacturer = require("./manufacturer");
43
43
  var import_store = require("./store");
44
44
  var import_index = require("./index.less");
45
45
  var import_locales2 = require("../../utils/locales");
46
+ var import_payLog = __toESM(require("./utils/payLog"));
46
47
  import_utils.locales.init(import_locales.default, (0, import_locales2.getLocale)());
47
48
  var eftposPay_default = (props) => {
48
- var _a, _b, _c, _d, _e, _f;
49
+ var _a, _b, _c, _d, _e, _f, _g, _h;
49
50
  const [check, setCheckStatus] = (0, import_react.useState)(
50
51
  props.type === import_const.EftposEnum.Tyro ? import_const.OrderEumn.Null : props.source === import_const.RestoreEumn.Restore ? import_const.OrderEumn.Restore : import_const.OrderEumn.Normal
51
52
  );
52
53
  const context = (0, import_useEngineContext.default)();
54
+ (0, import_payLog.usePayLog)({
55
+ paymentType: props.type,
56
+ mode: props.mode || import_const.ModeEnum.Pay,
57
+ orderId: (_a = props.params) == null ? void 0 : _a.order_id,
58
+ extra: {
59
+ initialParams: (props == null ? void 0 : props.params) || null,
60
+ initialSource: (props == null ? void 0 : props.source) || "",
61
+ initialDevice: (props == null ? void 0 : props.device) || null
62
+ }
63
+ });
53
64
  const [cardSurcharge, setCardSurcharge] = (0, import_react.useState)(0);
54
65
  const [receipt, setReceipt] = (0, import_react.useState)([]);
55
66
  const [updateTime, setTime] = (0, import_react.useState)("");
56
67
  console.log("context = ", context);
57
68
  const [historyData, setHistory] = (0, import_react.useState)();
58
- const { formatAmount, storage, store } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {
69
+ const { formatAmount, storage, store } = ((_b = context.appHelper) == null ? void 0 : _b.utils) || {
59
70
  store: {},
60
71
  formatAmount: (number, precision, symbol2) => `${symbol2}${number}`,
61
72
  storage: () => ({
@@ -63,23 +74,29 @@ var eftposPay_default = (props) => {
63
74
  })
64
75
  };
65
76
  const channel = (0, import_react.useMemo)(() => {
66
- var _a2;
67
- const channel2 = ((_a2 = storage == null ? void 0 : storage.get) == null ? void 0 : _a2.call(storage, "channel")) || "";
68
- if (channel2 === "terminal") {
77
+ var _a2, _b2;
78
+ if (((_a2 = props == null ? void 0 : props.params) == null ? void 0 : _a2.platform) === "kiosk") {
79
+ return "kiosk";
80
+ }
81
+ const rawChannel = ((_b2 = storage == null ? void 0 : storage.get) == null ? void 0 : _b2.call(storage, "channel")) || "";
82
+ if (rawChannel === "terminal") {
69
83
  return "terminal";
70
84
  }
71
- if (channel2 === "android_kiosk") {
85
+ if (rawChannel === "android_kiosk") {
72
86
  return "kiosk";
73
87
  }
74
88
  return "";
75
- }, []);
89
+ }, [(_c = props == null ? void 0 : props.params) == null ? void 0 : _c.platform, storage]);
90
+ (0, import_react.useEffect)(() => {
91
+ import_payLog.default.setContext({ channel: channel || "web" });
92
+ }, [channel]);
76
93
  const isMobile = (0, import_react.useMemo)(() => {
77
94
  if ((props == null ? void 0 : props.isWebPos) !== void 0 && typeof (props == null ? void 0 : props.isWebPos) === "boolean") {
78
95
  return !props.isWebPos;
79
96
  }
80
97
  return Boolean(channel);
81
98
  }, [channel, props.isWebPos]);
82
- const symbol = ((_d = (_c = (_b = store == null ? void 0 : store.getState) == null ? void 0 : _b.call(store)) == null ? void 0 : _c.global) == null ? void 0 : _d.symbol) || "$";
99
+ const symbol = ((_f = (_e = (_d = store == null ? void 0 : store.getState) == null ? void 0 : _d.call(store)) == null ? void 0 : _e.global) == null ? void 0 : _f.symbol) || "$";
83
100
  const mode = (0, import_react.useMemo)(() => {
84
101
  if (props.source === import_const.RestoreEumn.Restore) {
85
102
  if (props.params) {
@@ -104,8 +121,8 @@ var eftposPay_default = (props) => {
104
121
  props.params ? { mode, ...props.params, symbol: current } : { mode, symbol: current }
105
122
  );
106
123
  return {
107
- ...initState,
108
- originalParams: props.params || void 0
124
+ ...initState || {},
125
+ originalParams: props.params || {}
109
126
  };
110
127
  }, [mode, props.params, props.type, symbol]);
111
128
  const stateRef = (0, import_react.useRef)(state);
@@ -114,6 +131,7 @@ var eftposPay_default = (props) => {
114
131
  }, [state]);
115
132
  const onChangeStatus = (0, import_react.useCallback)(
116
133
  (status, params, other) => {
134
+ import_payLog.default.log("支付状态回调", { status, params, other });
117
135
  props.onChangeStatus(status, params, other);
118
136
  },
119
137
  []
@@ -148,9 +166,8 @@ var eftposPay_default = (props) => {
148
166
  }, [mode, state]);
149
167
  (0, import_react.useEffect)(() => {
150
168
  document.body.id = "body";
151
- console.log("初始化 ........112218017777");
152
169
  }, []);
153
- console.log("props?.params?.device_number = ", (_e = props == null ? void 0 : props.params) == null ? void 0 : _e.device_number);
170
+ console.log("props?.params?.device_number = ", (_g = props == null ? void 0 : props.params) == null ? void 0 : _g.device_number);
154
171
  const api = (0, import_react.useMemo)(() => {
155
172
  if (typeof props.getApi === "function") {
156
173
  return props.getApi();
@@ -161,12 +178,14 @@ var eftposPay_default = (props) => {
161
178
  if (props.source === import_const.RestoreEumn.Restore || props.type === import_const.EftposEnum.Tyro) {
162
179
  return;
163
180
  }
181
+ import_payLog.default.log("交易检查:开始检查交易");
164
182
  api.getTransaction({
165
183
  order_id: stateRef.current.order_id,
166
184
  card_reader_type: stateRef.current.eftpos,
167
185
  receive_status: "unprocessed"
168
186
  }).then((res) => {
169
187
  if (!Array.isArray(res.data) || res.data.length === 0) {
188
+ import_payLog.default.log("交易检查:无未处理交易");
170
189
  setCheckStatus(import_const.OrderEumn.Null);
171
190
  return;
172
191
  }
@@ -181,6 +200,7 @@ var eftposPay_default = (props) => {
181
200
  const latest = list.pop();
182
201
  const numberList = list.map((item) => item.number);
183
202
  if (latest.status === import_const.OrderEumn.Failed) {
203
+ import_payLog.default.log("交易检查:最新交易已失败", { number: latest.number });
184
204
  setCheckStatus(latest.status);
185
205
  onChangeStatus("mark_tx_processed", [
186
206
  ...numberList,
@@ -204,8 +224,13 @@ var eftposPay_default = (props) => {
204
224
  decodeURIComponent(atob(decodeURIComponent(pay_param_base64)))
205
225
  );
206
226
  setHistory(data);
227
+ import_payLog.default.log("交易检查:发现待处理交易", {
228
+ status: latest.status,
229
+ number: latest.number
230
+ });
207
231
  setCheckStatus(latest.status);
208
232
  } catch (e) {
233
+ import_payLog.default.log("交易检查:解析交易数据失败", { error: e });
209
234
  setCheckStatus(import_const.OrderEumn.Failed);
210
235
  return;
211
236
  }
@@ -241,7 +266,7 @@ var eftposPay_default = (props) => {
241
266
  source: props.source,
242
267
  tyroUrl: props.tyroUrl,
243
268
  tyroVersion: props.tyroVersion,
244
- device_number: (_f = props == null ? void 0 : props.params) == null ? void 0 : _f.device_number,
269
+ device_number: (_h = props == null ? void 0 : props.params) == null ? void 0 : _h.device_number,
245
270
  isMobile,
246
271
  formatAmount,
247
272
  styles: props.styles
@@ -72,7 +72,7 @@ var const_default = (params) => {
72
72
  status: import_const.StatusEnum.Loading,
73
73
  steps: getStep(mode),
74
74
  render: true,
75
- client: client !== "undefined" ? client : import_const.ClientEnum.Merchant,
75
+ client: client !== "undefined" && client !== void 0 ? client : import_const.ClientEnum.Merchant,
76
76
  warn: "",
77
77
  custom: other || {},
78
78
  ...typeof net !== "undefined" ? { net } : {},
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/components/eftposPay/linkly/hooks/normal.ts
@@ -32,6 +42,7 @@ var import_hooks = require("../../hooks");
32
42
  var import_const = require("../../const");
33
43
  var import_store = require("../../store");
34
44
  var import_const2 = require("../const");
45
+ var import_payLog = __toESM(require("../../utils/payLog"));
35
46
  var useLinklyPayOrRefund = (handleCheck) => {
36
47
  const dispatch = (0, import_store.useDispatch)();
37
48
  const { numRef, modeRef, orderIdRef, deviceRef, payRef, amountRef } = (0, import_hooks.useStoreRef)();
@@ -58,10 +69,7 @@ var useLinklyPayOrRefund = (handleCheck) => {
58
69
  if (!handleCheck()) {
59
70
  return;
60
71
  }
61
- (0, import_utils.sendWarningLog)({
62
- title: `Linkly-${isPay ? "Pay" : "Refund"}-接口成功`,
63
- content: [{ key: "response", value: JSON.stringify(res) }]
64
- });
72
+ import_payLog.default.log(`Linkly:${isPay ? "支付" : "退款"}接口成功`, { res });
65
73
  const status = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.status;
66
74
  if (status == 0) {
67
75
  numRef.current = (_b = res == null ? void 0 : res.data) == null ? void 0 : _b.session_id;
@@ -89,9 +97,8 @@ var useLinklyPayOrRefund = (handleCheck) => {
89
97
  if (!handleCheck()) {
90
98
  return;
91
99
  }
92
- (0, import_utils.sendWarningLog)({
93
- title: `Linkly-${isPay ? "Pay" : "Refund"}-接口失败`,
94
- content: [{ key: "error", value: JSON.stringify(error) }]
100
+ import_payLog.default.log(`Linkly:${isPay ? "支付" : "退款"}接口失败`, {
101
+ error: JSON.stringify(error || {})
95
102
  });
96
103
  (_a = failRef.current) == null ? void 0 : _a.call(failRef, error, false);
97
104
  };
@@ -107,10 +114,8 @@ var useLinklyPayOrRefund = (handleCheck) => {
107
114
  // 交易金额, 包含选择的订单金额+手续费,订单金额+手续费=交易金额
108
115
  amount: isPay ? (_c = payRef.current) == null ? void 0 : _c.total : amountRef.current
109
116
  };
110
- (0, import_utils.sendWarningLog)({
111
- title: `Linkly-${isPay ? "Pay" : "Refund"}`,
112
- content: [{ key: "params", value: JSON.stringify(param) }]
113
- });
117
+ import_payLog.default.setContext({ transactionNumber: String(orderIdRef.current) });
118
+ import_payLog.default.log(`Linkly:发起${isPay ? "支付" : "退款"}`, { param });
114
119
  _pay.run(param);
115
120
  };
116
121
  return {
@@ -129,17 +134,7 @@ var useLinklyCancel = (handleCheck) => {
129
134
  if (!handleCheck()) {
130
135
  return;
131
136
  }
132
- if (type === "success") {
133
- (0, import_utils.sendWarningLog)({
134
- title: `Linkly-${isPay ? "Pay" : "Refund"}-取消成功`,
135
- content: [{ key: "response", value: JSON.stringify(res) }]
136
- });
137
- } else {
138
- (0, import_utils.sendWarningLog)({
139
- title: `Linkly-${isPay ? "Pay" : "Refund"}-取消失败`,
140
- content: [{ key: "error", value: JSON.stringify(res) }]
141
- });
142
- }
137
+ import_payLog.default.log(`Linkly:取消${type === "success" ? "成功" : "失败"}`, { res });
143
138
  (_a = resultQueryRef.current) == null ? void 0 : _a.call(resultQueryRef);
144
139
  };
145
140
  const _cancel = (0, import_ahooks.useRequest)(
@@ -155,15 +150,10 @@ var useLinklyCancel = (handleCheck) => {
155
150
  resultQueryRef.current = resultQuery;
156
151
  dispatch((0, import_store.updateCustom)({ buttonDisabled: true }));
157
152
  const param = {
158
- // 设备id
159
153
  pinpad_id: (_b = (_a = deviceRef == null ? void 0 : deviceRef.current) == null ? void 0 : _a.metadata) == null ? void 0 : _b.linkly_pinpad_id,
160
- // 交易流水号
161
154
  session_id: numRef.current
162
155
  };
163
- (0, import_utils.sendWarningLog)({
164
- title: `Linkly-${isPay ? "Pay" : "Refund"}-取消`,
165
- content: [{ key: "params", value: JSON.stringify(param) }]
166
- });
156
+ import_payLog.default.log("Linkly:发起取消", { param });
167
157
  _cancel.run(param);
168
158
  dispatch((0, import_store.updateCustom)({ actionStatus: import_const2.LinklyActionStatus.CancelWaiting }));
169
159
  };
@@ -183,17 +173,9 @@ var useLinklySignature = (handleCheck) => {
183
173
  if (!handleCheck()) {
184
174
  return;
185
175
  }
186
- if (type === "success") {
187
- (0, import_utils.sendWarningLog)({
188
- title: `Linkly-${isPay ? "Pay" : "Refund"}-签名成功`,
189
- content: [{ key: "response", value: JSON.stringify(res) }]
190
- });
191
- } else {
192
- (0, import_utils.sendWarningLog)({
193
- title: `Linkly-${isPay ? "Pay" : "Refund"}-签名失败`,
194
- content: [{ key: "error", value: JSON.stringify(res) }]
195
- });
196
- }
176
+ import_payLog.default.log(`Linkly:签名接口${type === "success" ? "成功" : "失败"}`, {
177
+ res
178
+ });
197
179
  (_a = resultQueryRef.current) == null ? void 0 : _a.call(resultQueryRef);
198
180
  };
199
181
  const _signature = (0, import_ahooks.useRequest)(
@@ -223,10 +205,7 @@ var useLinklySignature = (handleCheck) => {
223
205
  dispatch(
224
206
  (0, import_store.updateCustom)({ actionStatus: import_const2.LinklyActionStatus.SignatureWaiting })
225
207
  );
226
- (0, import_utils.sendWarningLog)({
227
- title: `Linkly-${isPay ? "Pay" : "Refund"}-签名`,
228
- content: [{ key: "params", value: JSON.stringify(param) }]
229
- });
208
+ import_payLog.default.log("Linkly:发起签名", { param });
230
209
  _signature.run(param);
231
210
  };
232
211
  return {
@@ -34,17 +34,17 @@ __export(useTimeQuery_exports, {
34
34
  module.exports = __toCommonJS(useTimeQuery_exports);
35
35
  var import_react = require("react");
36
36
  var import_utils = require("@pisell/utils");
37
- var import_dayjs = __toESM(require("dayjs"));
38
37
  var import_store = require("../../store");
39
38
  var import_hooks = require("../../hooks");
40
39
  var import_const = require("../../const");
41
40
  var import_const2 = require("../const");
41
+ var import_payLog = __toESM(require("../../utils/payLog"));
42
42
  var GlobalTimeout = 1e3 * 60 * 2;
43
43
  var RequestTimeout = 1e3 * 5;
44
44
  var QUERY_INTERVAL = 1e3 * 2;
45
45
  var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
46
46
  const dispatch = (0, import_store.useDispatch)();
47
- const { numRef, modeRef, deviceRef, orderIdRef } = (0, import_hooks.useStoreRef)();
47
+ const { numRef, modeRef, deviceRef } = (0, import_hooks.useStoreRef)();
48
48
  const fail = (0, import_hooks.useFail)(0);
49
49
  const failRef = (0, import_react.useRef)(fail);
50
50
  const isPay = modeRef.current === import_const.ModeEnum.Pay || modeRef.current === import_const.ModeEnum.FullPay;
@@ -56,7 +56,6 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
56
56
  const isRequestCanceledRef = (0, import_react.useRef)(false);
57
57
  const startTimeRef = (0, import_react.useRef)(null);
58
58
  const isQueryFinishedRef = (0, import_react.useRef)(true);
59
- const queryIdRef = (0, import_react.useRef)(null);
60
59
  const queryIntervalTimerRef = (0, import_react.useRef)(null);
61
60
  const _resultQuery = async () => {
62
61
  var _a, _b;
@@ -73,8 +72,7 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
73
72
  isRequestCanceledRef.current = false;
74
73
  requestTimeoutIdRef.current = setTimeout(() => {
75
74
  var _a2;
76
- console.log("单次请求超时,将尝试重试");
77
- _log("RequestTimeout" /* RequestTimeout */);
75
+ import_payLog.default.log("Linkly轮询:单次请求超时");
78
76
  (_a2 = controllerRef.current) == null ? void 0 : _a2.abort();
79
77
  isRequestCanceledRef.current = true;
80
78
  }, RequestTimeout);
@@ -96,18 +94,13 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
96
94
  isQueryFinishedRef.current = true;
97
95
  const data = (result == null ? void 0 : result.data) || {};
98
96
  if (data.status == 1) {
99
- console.log("交易成功,终止查询");
100
- (0, import_utils.sendWarningLog)({
101
- title: `Linkly-${isPay ? "Pay" : "Refund"}-交易成功`,
102
- content: [{ key: "response", value: JSON.stringify(result) }]
103
- });
97
+ import_payLog.default.log("Linkly轮询:交易成功");
104
98
  reset();
105
99
  handleLinklySuccess(result);
106
100
  return;
107
101
  }
108
102
  if ((data == null ? void 0 : data.status) == 0 && (data == null ? void 0 : data.signature_flag) != 1) {
109
- console.log("交易状态为0需要继续查询");
110
- _log("Querying" /* Querying */, result);
103
+ import_payLog.default.log("Linkly轮询:继续查询", { data });
111
104
  isQueryFinishedRef.current = false;
112
105
  queryIntervalTimerRef.current = setTimeout(() => {
113
106
  _resultQuery();
@@ -115,22 +108,14 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
115
108
  return;
116
109
  }
117
110
  if (data.status < 0) {
118
- console.log("交易失败,终止查询");
119
- (0, import_utils.sendWarningLog)({
120
- title: `Linkly-${isPay ? "Pay" : "Refund"}-交易失败`,
121
- content: [{ key: "response", value: JSON.stringify(result) }]
122
- });
111
+ import_payLog.default.log("Linkly轮询:交易失败", { data });
123
112
  reset();
124
113
  result.code = import_const.PayStatus.Unknown;
125
114
  (_a2 = failRef.current) == null ? void 0 : _a2.call(failRef, result, false);
126
115
  return;
127
116
  }
128
117
  if (data.signature_flag == 1) {
129
- console.log("交易需要签名,终止查询");
130
- (0, import_utils.sendWarningLog)({
131
- title: `Linkly-${isPay ? "Pay" : "Refund"}-交易需要签名`,
132
- content: [{ key: "response", value: JSON.stringify(result) }]
133
- });
118
+ import_payLog.default.log("Linkly轮询:需要签名", { data });
134
119
  reset();
135
120
  gotoSignature();
136
121
  return;
@@ -144,8 +129,7 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
144
129
  }
145
130
  isQueryFinishedRef.current = true;
146
131
  if ((error == null ? void 0 : error.name) === "AbortError" /* AbortError */ || isRequestCanceledRef.current) {
147
- _log("AbortError" /* AbortError */);
148
- console.log("Error: 请求被取消,将继续查询");
132
+ import_payLog.default.log("Linkly轮询:请求被取消,继续查询");
149
133
  isQueryFinishedRef.current = false;
150
134
  queryIntervalTimerRef.current = setTimeout(() => {
151
135
  _resultQuery();
@@ -153,15 +137,14 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
153
137
  return;
154
138
  }
155
139
  if (!(error == null ? void 0 : error.code) || `${error.code}` === import_const.PayStatus.Timeout) {
156
- _log("NetworkError" /* NetworkError */);
157
- console.log("Error: 网关类报错,将继续查询");
140
+ import_payLog.default.log("Linkly轮询:网关报错,继续查询");
158
141
  isQueryFinishedRef.current = false;
159
142
  queryIntervalTimerRef.current = setTimeout(() => {
160
143
  _resultQuery();
161
144
  }, QUERY_INTERVAL);
162
145
  return;
163
146
  }
164
- _log("Error" /* Error */, error);
147
+ import_payLog.default.log("Linkly轮询:查询失败", { error });
165
148
  reset();
166
149
  (_a2 = failRef.current) == null ? void 0 : _a2.call(failRef, error, true);
167
150
  }).finally(() => {
@@ -195,8 +178,7 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
195
178
  return false;
196
179
  };
197
180
  const reset = () => {
198
- console.log("linkly查询状态重制<<<<<<<----");
199
- _log("Reset" /* Reset */);
181
+ import_payLog.default.log("Linkly轮询:重置查询状态");
200
182
  if (globalTimeoutIdRef.current) {
201
183
  clearTimeout(globalTimeoutIdRef.current);
202
184
  globalTimeoutIdRef.current = null;
@@ -216,52 +198,18 @@ var useTimeResultQuery = (api, resultCheck, handleLinklySuccess) => {
216
198
  startTimeRef.current = null;
217
199
  isRequestCanceledRef.current = false;
218
200
  isQueryFinishedRef.current = true;
219
- queryIdRef.current = null;
220
- };
221
- const _log = (type, res) => {
222
- var _a, _b;
223
- const params = {
224
- // 设备id
225
- pinpad_id: (_b = (_a = deviceRef == null ? void 0 : deviceRef.current) == null ? void 0 : _a.metadata) == null ? void 0 : _b.linkly_pinpad_id,
226
- // 交易流水号
227
- session_id: numRef.current
228
- };
229
- const content = [
230
- {
231
- key: "description",
232
- value: JSON.stringify({
233
- queryId: queryIdRef.current,
234
- orderId: orderIdRef.current,
235
- type,
236
- date: (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss")
237
- })
238
- },
239
- { key: "params", value: JSON.stringify(params) }
240
- ];
241
- if (type === "Error" /* Error */) {
242
- content.push({ key: "error", value: JSON.stringify(res) });
243
- } else {
244
- content.push({ key: "response", value: JSON.stringify(res) });
245
- }
246
- (0, import_utils.sendWarningLog)({
247
- title: `Linkly-${isPay ? "Pay" : "Refund"}-交易结果轮询`,
248
- content
249
- });
250
201
  };
251
202
  const run = () => {
252
203
  reset();
253
204
  globalTimeoutIdRef.current = setTimeout(() => {
254
205
  var _a;
255
- console.log("全局超时,终止所有重试");
256
- _log("GlobalTimeout" /* GlobalTimeout */);
206
+ import_payLog.default.log("Linkly轮询:全局超时");
257
207
  setTimeout(reset, 0);
258
208
  (_a = failRef.current) == null ? void 0 : _a.call(failRef, { code: import_const.PayStatus.Timeout }, false);
259
209
  }, GlobalTimeout);
260
210
  startTimeRef.current = Date.now();
261
211
  isQueryFinishedRef.current = false;
262
- queryIdRef.current = (0, import_utils.getUniqueId)();
263
- console.log("开始查询linkly结果---->>>>>>>");
264
- _log("Start" /* Start */);
212
+ import_payLog.default.log("Linkly轮询:开始查询");
265
213
  return _resultQuery();
266
214
  };
267
215
  return { run, stop: reset };
@@ -44,6 +44,7 @@ var import_const = require("../const");
44
44
  var import_hooks2 = require("./hooks");
45
45
  var import_const2 = require("./const");
46
46
  var import_helper = require("../helper");
47
+ var import_payLog = __toESM(require("../utils/payLog"));
47
48
  var Linkly = ({ api, onChange }) => {
48
49
  const context = (0, import_useEngineContext.default)();
49
50
  const utils = context.appHelper.utils || {};
@@ -69,6 +70,7 @@ var Linkly = ({ api, onChange }) => {
69
70
  const clearRef = (0, import_react.useRef)();
70
71
  const handleCheck = () => !(unloadRef.current || !netRef.current);
71
72
  const handleLinklySuccess = (res) => {
73
+ import_payLog.default.log("Linkly:最终支付成功");
72
74
  const resData = (res == null ? void 0 : res.data) || {};
73
75
  let receipt = Array.isArray(resData == null ? void 0 : resData.receipt) ? resData.receipt : [resData.receipt];
74
76
  receipt = receipt.filter((item) => typeof item === "string").filter(Boolean);
@@ -126,6 +128,7 @@ var Linkly = ({ api, onChange }) => {
126
128
  }, [fail]);
127
129
  (0, import_react.useEffect)(() => {
128
130
  var _a, _b, _c;
131
+ console.log("statusRef.current11111", statusRef.current);
129
132
  if (statusRef.current === import_const.StatusEnum.Success || statusRef.current === import_const.StatusEnum.Fail) {
130
133
  return;
131
134
  }
@@ -148,18 +151,10 @@ var Linkly = ({ api, onChange }) => {
148
151
  if (activeStatus !== "unActive") {
149
152
  payOrRefund(resultQuery, handleLinklySuccess);
150
153
  } else {
151
- (0, import_utils.sendWarningLog)({
152
- title: "Linkly-支付-当前页面非活跃状态,无法进行支付",
153
- content: [
154
- { key: "response", value: JSON.stringify({ activeStatus }) }
155
- ]
156
- });
154
+ import_payLog.default.log("Linkly:页面非活跃状态,阻断支付", { activeStatus });
157
155
  }
158
156
  } catch (error) {
159
- (0, import_utils.sendWarningLog)({
160
- title: "Linkly-支付-获取当前页面活跃状态失败",
161
- content: [{ key: "error", value: JSON.stringify(error) }]
162
- });
157
+ import_payLog.default.log("Linkly:获取页面活跃状态失败", { error });
163
158
  payOrRefund(resultQuery, handleLinklySuccess);
164
159
  }
165
160
  };
@@ -179,14 +174,17 @@ var Linkly = ({ api, onChange }) => {
179
174
  };
180
175
  }, []);
181
176
  const onCancel = () => {
177
+ import_payLog.default.log("Linkly:点击取消支付");
182
178
  stopResultQuery();
183
179
  linklyCancel(resultQuery);
184
180
  };
185
181
  const onDecline = () => {
182
+ import_payLog.default.log("Linkly:签名-点击拒绝");
186
183
  stopResultQuery();
187
184
  linklySignature(2, resultQuery);
188
185
  };
189
186
  const onAccept = () => {
187
+ import_payLog.default.log("Linkly:签名-点击接受");
190
188
  stopResultQuery();
191
189
  linklySignature(3, resultQuery);
192
190
  };
@@ -119,6 +119,9 @@ declare const _default: {
119
119
  'page.eftpos-pay.text.huifu.scan.input-tip': string;
120
120
  'page.eftpos-pay.text.huifu.scan.cancel': string;
121
121
  'page.eftpos-pay.text.huifu.scan.confirm': string;
122
+ 'page.eftpos-pay.text.mx51.result.loading': string;
123
+ 'page.eftpos-pay.text.manual.success.toast': string;
124
+ 'page.eftpos-pay.text.manual.fail.toast': string;
122
125
  };
123
126
  'zh-CN': {
124
127
  'page.eftpos-pay.text.loading': (mode: string) => string;
@@ -240,6 +243,9 @@ declare const _default: {
240
243
  'page.eftpos-pay.text.huifu.scan.input-tip': string;
241
244
  'page.eftpos-pay.text.huifu.scan.cancel': string;
242
245
  'page.eftpos-pay.text.huifu.scan.confirm': string;
246
+ 'page.eftpos-pay.text.mx51.result.loading': string;
247
+ 'page.eftpos-pay.text.manual.success.toast': string;
248
+ 'page.eftpos-pay.text.manual.fail.toast': string;
243
249
  };
244
250
  'zh-HK': {
245
251
  'page.eftpos-pay.text.loading': (mode: string) => string;
@@ -361,6 +367,9 @@ declare const _default: {
361
367
  'page.eftpos-pay.text.huifu.scan.input-tip': string;
362
368
  'page.eftpos-pay.text.huifu.scan.cancel': string;
363
369
  'page.eftpos-pay.text.huifu.scan.confirm': string;
370
+ 'page.eftpos-pay.text.mx51.result.loading': string;
371
+ 'page.eftpos-pay.text.manual.success.toast': string;
372
+ 'page.eftpos-pay.text.manual.fail.toast': string;
364
373
  };
365
374
  ja: {
366
375
  'page.eftpos-pay.text.loading': (mode: string) => string;
@@ -482,6 +491,9 @@ declare const _default: {
482
491
  'page.eftpos-pay.text.huifu.scan.input-tip': string;
483
492
  'page.eftpos-pay.text.huifu.scan.cancel': string;
484
493
  'page.eftpos-pay.text.huifu.scan.confirm': string;
494
+ 'page.eftpos-pay.text.mx51.result.loading': string;
495
+ 'page.eftpos-pay.text.manual.success.toast': string;
496
+ 'page.eftpos-pay.text.manual.fail.toast': string;
485
497
  };
486
498
  pt: {
487
499
  'page.eftpos-pay.text.loading': (mode: string) => string;
@@ -603,6 +615,9 @@ declare const _default: {
603
615
  'page.eftpos-pay.text.huifu.scan.input-tip': string;
604
616
  'page.eftpos-pay.text.huifu.scan.cancel': string;
605
617
  'page.eftpos-pay.text.huifu.scan.confirm': string;
618
+ 'page.eftpos-pay.text.mx51.result.loading': string;
619
+ 'page.eftpos-pay.text.manual.success.toast': string;
620
+ 'page.eftpos-pay.text.manual.fail.toast': string;
606
621
  };
607
622
  };
608
623
  export default _default;