@pisell/private-materials 6.3.124 → 6.3.125

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 (73) 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/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +1 -1
  6. package/build/lowcode/view.js +1 -1
  7. package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  8. package/es/components/eftpos/hooks.d.ts +0 -1
  9. package/es/components/eftposPay/amount.js +15 -1
  10. package/es/components/eftposPay/app.js +2 -1
  11. package/es/components/eftposPay/component/fail/failCustom.js +12 -4
  12. package/es/components/eftposPay/component/fail/index.js +14 -6
  13. package/es/components/eftposPay/component/fail/network.js +3 -0
  14. package/es/components/eftposPay/component/fail/unknow.js +8 -0
  15. package/es/components/eftposPay/component/manual/index.js +13 -1
  16. package/es/components/eftposPay/component/signature/index.js +3 -0
  17. package/es/components/eftposPay/device.js +33 -22
  18. package/es/components/eftposPay/index.js +48 -11
  19. package/es/components/eftposPay/linkly/hooks/normal.js +21 -68
  20. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +20 -81
  21. package/es/components/eftposPay/linkly/index.js +10 -23
  22. package/es/components/eftposPay/pay.js +14 -7
  23. package/es/components/eftposPay/payo/config.js +38 -5
  24. package/es/components/eftposPay/payo/hooks.js +3 -12
  25. package/es/components/eftposPay/payo/payment.js +69 -136
  26. package/es/components/eftposPay/tip.js +5 -0
  27. package/es/components/eftposPay/tyro/hooks.d.ts +0 -1
  28. package/es/components/eftposPay/tyro/index.js +44 -11
  29. package/es/components/eftposPay/utils/payLog.d.ts +81 -0
  30. package/es/components/eftposPay/utils/payLog.js +430 -0
  31. package/es/components/eftposPay/windcave/receiptAction.js +5 -0
  32. package/es/components/eftposPay/windcave/windcave.js +28 -29
  33. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
  34. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  35. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  36. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
  37. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  38. package/es/components/shoppingCart/components/Empty/index.d.ts +0 -1
  39. package/es/hooks/usePaymentLogger.d.ts +0 -1
  40. package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  41. package/lib/components/eftpos/hooks.d.ts +0 -1
  42. package/lib/components/eftposPay/amount.js +13 -1
  43. package/lib/components/eftposPay/app.js +2 -1
  44. package/lib/components/eftposPay/component/fail/failCustom.js +10 -2
  45. package/lib/components/eftposPay/component/fail/index.js +10 -2
  46. package/lib/components/eftposPay/component/fail/network.js +3 -0
  47. package/lib/components/eftposPay/component/fail/unknow.js +8 -0
  48. package/lib/components/eftposPay/component/manual/index.js +10 -0
  49. package/lib/components/eftposPay/component/signature/index.js +3 -0
  50. package/lib/components/eftposPay/device.js +11 -10
  51. package/lib/components/eftposPay/index.js +36 -11
  52. package/lib/components/eftposPay/linkly/hooks/normal.js +22 -43
  53. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +13 -65
  54. package/lib/components/eftposPay/linkly/index.js +7 -10
  55. package/lib/components/eftposPay/pay.js +9 -1
  56. package/lib/components/eftposPay/payo/config.js +15 -8
  57. package/lib/components/eftposPay/payo/hooks.js +12 -10
  58. package/lib/components/eftposPay/payo/payment.js +31 -65
  59. package/lib/components/eftposPay/tip.js +5 -0
  60. package/lib/components/eftposPay/tyro/hooks.d.ts +0 -1
  61. package/lib/components/eftposPay/tyro/index.js +21 -17
  62. package/lib/components/eftposPay/utils/payLog.d.ts +81 -0
  63. package/lib/components/eftposPay/utils/payLog.js +320 -0
  64. package/lib/components/eftposPay/windcave/receiptAction.js +5 -0
  65. package/lib/components/eftposPay/windcave/windcave.js +18 -20
  66. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
  67. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  68. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  69. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
  70. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  71. package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -1
  72. package/lib/hooks/usePaymentLogger.d.ts +0 -1
  73. package/package.json +1 -1
@@ -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,18 +74,24 @@ 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)(() => Boolean(channel), [channel]);
77
- 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) || "$";
94
+ 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) || "$";
78
95
  const mode = (0, import_react.useMemo)(() => {
79
96
  if (props.source === import_const.RestoreEumn.Restore) {
80
97
  if (props.params) {
@@ -109,6 +126,7 @@ var eftposPay_default = (props) => {
109
126
  }, [state]);
110
127
  const onChangeStatus = (0, import_react.useCallback)(
111
128
  (status, params, other) => {
129
+ import_payLog.default.log("支付状态回调", { status, params, other });
112
130
  props.onChangeStatus(status, params, other);
113
131
  },
114
132
  []
@@ -143,9 +161,8 @@ var eftposPay_default = (props) => {
143
161
  }, [mode, state]);
144
162
  (0, import_react.useEffect)(() => {
145
163
  document.body.id = "body";
146
- console.log("初始化 ........112218017777");
147
164
  }, []);
148
- console.log("props?.params?.device_number = ", (_e = props == null ? void 0 : props.params) == null ? void 0 : _e.device_number);
165
+ console.log("props?.params?.device_number = ", (_g = props == null ? void 0 : props.params) == null ? void 0 : _g.device_number);
149
166
  const api = (0, import_react.useMemo)(() => {
150
167
  if (typeof props.getApi === "function") {
151
168
  return props.getApi();
@@ -156,12 +173,14 @@ var eftposPay_default = (props) => {
156
173
  if (props.source === import_const.RestoreEumn.Restore || props.type === import_const.EftposEnum.Tyro) {
157
174
  return;
158
175
  }
176
+ import_payLog.default.log("交易检查:开始检查交易");
159
177
  api.getTransaction({
160
178
  order_id: stateRef.current.order_id,
161
179
  card_reader_type: stateRef.current.eftpos,
162
180
  receive_status: "unprocessed"
163
181
  }).then((res) => {
164
182
  if (!Array.isArray(res.data) || res.data.length === 0) {
183
+ import_payLog.default.log("交易检查:无未处理交易");
165
184
  setCheckStatus(import_const.OrderEumn.Null);
166
185
  return;
167
186
  }
@@ -176,6 +195,7 @@ var eftposPay_default = (props) => {
176
195
  const latest = list.pop();
177
196
  const numberList = list.map((item) => item.number);
178
197
  if (latest.status === import_const.OrderEumn.Failed) {
198
+ import_payLog.default.log("交易检查:最新交易已失败", { number: latest.number });
179
199
  setCheckStatus(latest.status);
180
200
  onChangeStatus("mark_tx_processed", [
181
201
  ...numberList,
@@ -199,8 +219,13 @@ var eftposPay_default = (props) => {
199
219
  decodeURIComponent(atob(decodeURIComponent(pay_param_base64)))
200
220
  );
201
221
  setHistory(data);
222
+ import_payLog.default.log("交易检查:发现待处理交易", {
223
+ status: latest.status,
224
+ number: latest.number
225
+ });
202
226
  setCheckStatus(latest.status);
203
227
  } catch (e) {
228
+ import_payLog.default.log("交易检查:解析交易数据失败", { error: e });
204
229
  setCheckStatus(import_const.OrderEumn.Failed);
205
230
  return;
206
231
  }
@@ -236,7 +261,7 @@ var eftposPay_default = (props) => {
236
261
  source: props.source,
237
262
  tyroUrl: props.tyroUrl,
238
263
  tyroVersion: props.tyroVersion,
239
- device_number: (_f = props == null ? void 0 : props.params) == null ? void 0 : _f.device_number,
264
+ device_number: (_h = props == null ? void 0 : props.params) == null ? void 0 : _h.device_number,
240
265
  isMobile,
241
266
  formatAmount
242
267
  }
@@ -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);
@@ -148,18 +150,10 @@ var Linkly = ({ api, onChange }) => {
148
150
  if (activeStatus !== "unActive") {
149
151
  payOrRefund(resultQuery, handleLinklySuccess);
150
152
  } else {
151
- (0, import_utils.sendWarningLog)({
152
- title: "Linkly-支付-当前页面非活跃状态,无法进行支付",
153
- content: [
154
- { key: "response", value: JSON.stringify({ activeStatus }) }
155
- ]
156
- });
153
+ import_payLog.default.log("Linkly:页面非活跃状态,阻断支付", { activeStatus });
157
154
  }
158
155
  } catch (error) {
159
- (0, import_utils.sendWarningLog)({
160
- title: "Linkly-支付-获取当前页面活跃状态失败",
161
- content: [{ key: "error", value: JSON.stringify(error) }]
162
- });
156
+ import_payLog.default.log("Linkly:获取页面活跃状态失败", { error });
163
157
  payOrRefund(resultQuery, handleLinklySuccess);
164
158
  }
165
159
  };
@@ -179,14 +173,17 @@ var Linkly = ({ api, onChange }) => {
179
173
  };
180
174
  }, []);
181
175
  const onCancel = () => {
176
+ import_payLog.default.log("Linkly:点击取消支付");
182
177
  stopResultQuery();
183
178
  linklyCancel(resultQuery);
184
179
  };
185
180
  const onDecline = () => {
181
+ import_payLog.default.log("Linkly:签名-点击拒绝");
186
182
  stopResultQuery();
187
183
  linklySignature(2, resultQuery);
188
184
  };
189
185
  const onAccept = () => {
186
+ import_payLog.default.log("Linkly:签名-点击接受");
190
187
  stopResultQuery();
191
188
  linklySignature(3, resultQuery);
192
189
  };
@@ -46,6 +46,7 @@ var import_const = require("./const");
46
46
  var import_manufacturer = require("./manufacturer");
47
47
  var import_store = require("./store");
48
48
  var import_index = require("./index.less");
49
+ var import_payLog = __toESM(require("./utils/payLog"));
49
50
  var Mapping = {
50
51
  Fail: import_fail.default,
51
52
  Network: import_network.default,
@@ -73,7 +74,10 @@ var Pay = ({
73
74
  const statusRef = (0, import_react.useRef)(data.status);
74
75
  const comonentRef = (0, import_react.useRef)(data.component);
75
76
  const backupRef = (0, import_react.useRef)(data.backup);
76
- const clearRef = (0, import_react.useRef)(0);
77
+ const clearRef = (0, import_react.useRef)(null);
78
+ (0, import_react.useEffect)(() => {
79
+ import_payLog.default.log("支付组件初始化");
80
+ }, []);
77
81
  (0, import_react.useEffect)(() => {
78
82
  comonentRef.current = data.component;
79
83
  }, [data.component]);
@@ -107,6 +111,7 @@ var Pay = ({
107
111
  if (!ref.current) {
108
112
  ref.current = true;
109
113
  if (backupRef.current && net) {
114
+ import_payLog.default.log("网络恢复:从备份恢复", { hasBackup: true });
110
115
  const { ...data2 } = backupRef.current;
111
116
  dispatch((0, import_store.backUpFree)({ key: Date.now() }));
112
117
  dispatch((0, import_store.updateState)({ net }));
@@ -121,6 +126,7 @@ var Pay = ({
121
126
  return;
122
127
  }
123
128
  if (net) {
129
+ import_payLog.default.log("网络恢复", { hasBackup: !!backupRef.current });
124
130
  const { ...data2 } = backupRef.current;
125
131
  dispatch((0, import_store.backUpFree)({ key: Date.now() }));
126
132
  dispatch((0, import_store.updateState)({ net }));
@@ -133,6 +139,7 @@ var Pay = ({
133
139
  }
134
140
  return;
135
141
  }
142
+ import_payLog.default.log("网络断开,备份数据");
136
143
  dispatch((0, import_store.updateState)({ form: "Network" }));
137
144
  dispatch((0, import_store.backUpProduction)({}));
138
145
  dispatch((0, import_store.updateState)({ net, status: "warn" }));
@@ -142,6 +149,7 @@ var Pay = ({
142
149
  return () => {
143
150
  if (clearRef.current) {
144
151
  clearTimeout(clearRef.current);
152
+ clearRef.current = null;
145
153
  }
146
154
  };
147
155
  }, []);
@@ -43,6 +43,7 @@ var import_hooks = require("../hooks");
43
43
  var import_store = require("../store");
44
44
  var import_hooks2 = require("./hooks");
45
45
  var import_payment = require("./payment");
46
+ var import_payLog = __toESM(require("../utils/payLog"));
46
47
  var POS = ({
47
48
  api,
48
49
  onChange
@@ -65,7 +66,7 @@ var POS = ({
65
66
  const fail = (0, import_hooks.useFail)(0);
66
67
  const failRef = (0, import_react.useRef)(fail);
67
68
  const controllerRef = (0, import_react.useRef)();
68
- const clearRef = (0, import_react.useRef)();
69
+ const clearRef = (0, import_react.useRef)(null);
69
70
  const initRef = (0, import_react.useRef)(false);
70
71
  const unloadRef = (0, import_react.useRef)(false);
71
72
  const [check] = (0, import_hooks2.useValidate)(1e3 * 60);
@@ -199,7 +200,9 @@ var POS = ({
199
200
  )
200
201
  )
201
202
  };
203
+ import_payLog.default.setContext({ transactionNumber: numRef.current });
202
204
  if (isPay) {
205
+ import_payLog.default.log("Payo:发起支付", { isPay, number: numRef.current });
203
206
  paymentRun({
204
207
  paymentType: import_payment.ActionType.Pay,
205
208
  paymentNum: numRef.current,
@@ -208,41 +211,42 @@ var POS = ({
208
211
  params: apiParams,
209
212
  callbacks: {
210
213
  onSuccess: (res) => {
214
+ import_payLog.default.log("Payo:支付成功", { code: res == null ? void 0 : res.code });
211
215
  success(res);
212
216
  },
213
217
  onError: (err) => {
214
- console.log("err = >>>>>", err);
218
+ import_payLog.default.log("Payo:支付失败", { code: err == null ? void 0 : err.code });
215
219
  failRef.current(err, true);
216
220
  }
217
221
  }
218
222
  });
219
223
  return;
220
224
  } else {
225
+ import_payLog.default.log("Payo:发起退款", { isPay, number: numRef.current });
221
226
  const resultPromise = api.refund(apiParams, { signal: controllerRef.current.signal });
222
227
  resultPromise.then((res) => {
223
228
  console.log("netRef.current111 = ", netRef.current);
224
229
  if (unloadRef.current || !netRef.current) {
230
+ import_payLog.default.log("Payo:退款拦截", { isUnload: unloadRef.current, isNet: netRef.current });
225
231
  return;
226
232
  }
227
233
  if (res && `${res.code}` === "200") {
234
+ import_payLog.default.log("Payo:退款成功", { res: JSON.stringify(res) });
228
235
  success(res);
229
236
  return;
230
237
  }
231
238
  return Promise.reject(res);
232
239
  }).catch((err) => {
233
- console.log(
234
- "netRef.current222 = ",
235
- netRef.current,
236
- unloadRef.current,
237
- err
238
- );
239
240
  if (unloadRef.current || !netRef.current) {
241
+ import_payLog.default.log("Payo:退款失败拦截", { isUnload: unloadRef.current, isNet: netRef.current });
240
242
  return;
241
243
  }
242
244
  if (!(err == null ? void 0 : err.code) || `${err.code}` === import_const.PayStatus.Timeout) {
245
+ import_payLog.default.log("Payo:退款超时,转查询");
243
246
  checkApi();
244
247
  return;
245
248
  }
249
+ import_payLog.default.log("Payo:退款失败", { code: err == null ? void 0 : err.code, message: err == null ? void 0 : err.message });
246
250
  failRef.current(err, true);
247
251
  });
248
252
  }
@@ -268,12 +272,14 @@ var Action = ({ onChange }) => {
268
272
  (0, import_react.useEffect)(() => {
269
273
  const timer = setTimeout(() => {
270
274
  setIsShowCancel(true);
275
+ import_payLog.default.log("Payo:30秒后显示取消按钮");
271
276
  }, 30 * 1e3);
272
277
  return () => {
273
278
  clearTimeout(timer);
274
279
  };
275
280
  }, []);
276
281
  const onManually = () => {
282
+ import_payLog.default.log("Payo:点击手动标记");
277
283
  dispatch(
278
284
  (0, import_store.updateState)({
279
285
  manual: {
@@ -285,6 +291,7 @@ var Action = ({ onChange }) => {
285
291
  dispatch((0, import_store.updateComponent)("Manual", true));
286
292
  };
287
293
  const onCancel = () => {
294
+ import_payLog.default.log("Payo:点击取消");
288
295
  onChange("fail", { number, uniquePaymentNumber: number, device, order_id });
289
296
  };
290
297
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, client !== import_const.ClientEnum.Merchant && isShowCancel && /* @__PURE__ */ import_react.default.createElement(