@pisell/private-materials 3.0.187 → 3.0.189

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 (75) 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 +3 -3
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +10 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +5 -5
  11. package/es/components/booking/info/utils.js +1 -1
  12. package/es/components/eftposPay/amount.d.ts +4 -3
  13. package/es/components/eftposPay/amount.js +5 -4
  14. package/es/components/eftposPay/component/fail/failCustom.d.ts +1 -1
  15. package/es/components/eftposPay/component/fail/failCustom.js +14 -6
  16. package/es/components/eftposPay/component/fail/index.d.ts +1 -1
  17. package/es/components/eftposPay/component/fail/index.js +14 -5
  18. package/es/components/eftposPay/component/fail/unknow.d.ts +1 -1
  19. package/es/components/eftposPay/component/fail/unknow.js +17 -7
  20. package/es/components/eftposPay/const.d.ts +8 -2
  21. package/es/components/eftposPay/const.js +5 -0
  22. package/es/components/eftposPay/device.d.ts +4 -3
  23. package/es/components/eftposPay/device.js +5 -4
  24. package/es/components/eftposPay/hooks.d.ts +4 -3
  25. package/es/components/eftposPay/hooks.js +31 -6
  26. package/es/components/eftposPay/index.js +57 -23
  27. package/es/components/eftposPay/index.less +1 -0
  28. package/es/components/eftposPay/locales.d.ts +6 -0
  29. package/es/components/eftposPay/locales.js +6 -0
  30. package/es/components/eftposPay/pay.d.ts +3 -2
  31. package/es/components/eftposPay/pay.js +8 -7
  32. package/es/components/eftposPay/payo/config.d.ts +3 -1
  33. package/es/components/eftposPay/payo/config.js +11 -9
  34. package/es/components/eftposPay/payo/const.js +4 -2
  35. package/es/components/eftposPay/payo/index.js +3 -1
  36. package/es/components/eftposPay/store/index.d.ts +17 -2
  37. package/es/components/eftposPay/store/index.js +20 -0
  38. package/es/components/eftposPay/tyro/const.js +4 -2
  39. package/es/components/eftposPay/tyro/index.js +70 -20
  40. package/es/components/eftposPay/windcave/const.js +4 -2
  41. package/es/components/eftposPay/windcave/helper.js +19 -28
  42. package/es/components/eftposPay/windcave/windcave.js +2 -1
  43. package/lib/components/booking/info/utils.js +1 -1
  44. package/lib/components/eftposPay/amount.d.ts +4 -3
  45. package/lib/components/eftposPay/amount.js +4 -3
  46. package/lib/components/eftposPay/component/fail/failCustom.d.ts +1 -1
  47. package/lib/components/eftposPay/component/fail/failCustom.js +16 -4
  48. package/lib/components/eftposPay/component/fail/index.d.ts +1 -1
  49. package/lib/components/eftposPay/component/fail/index.js +17 -4
  50. package/lib/components/eftposPay/component/fail/unknow.d.ts +1 -1
  51. package/lib/components/eftposPay/component/fail/unknow.js +15 -3
  52. package/lib/components/eftposPay/const.d.ts +8 -2
  53. package/lib/components/eftposPay/const.js +7 -0
  54. package/lib/components/eftposPay/device.d.ts +4 -3
  55. package/lib/components/eftposPay/device.js +5 -4
  56. package/lib/components/eftposPay/hooks.d.ts +4 -3
  57. package/lib/components/eftposPay/hooks.js +30 -8
  58. package/lib/components/eftposPay/index.js +46 -18
  59. package/lib/components/eftposPay/index.less +1 -0
  60. package/lib/components/eftposPay/locales.d.ts +6 -0
  61. package/lib/components/eftposPay/locales.js +6 -0
  62. package/lib/components/eftposPay/pay.d.ts +3 -2
  63. package/lib/components/eftposPay/pay.js +7 -6
  64. package/lib/components/eftposPay/payo/config.d.ts +3 -1
  65. package/lib/components/eftposPay/payo/config.js +8 -8
  66. package/lib/components/eftposPay/payo/const.js +2 -0
  67. package/lib/components/eftposPay/payo/index.js +1 -1
  68. package/lib/components/eftposPay/store/index.d.ts +17 -2
  69. package/lib/components/eftposPay/store/index.js +14 -0
  70. package/lib/components/eftposPay/tyro/const.js +2 -0
  71. package/lib/components/eftposPay/tyro/index.js +63 -6
  72. package/lib/components/eftposPay/windcave/const.js +2 -0
  73. package/lib/components/eftposPay/windcave/helper.js +23 -28
  74. package/lib/components/eftposPay/windcave/windcave.js +2 -1
  75. package/package.json +3 -3
@@ -37,6 +37,7 @@ declare const _default: {
37
37
  'page.eftpos-pay.text.manual.diff': string;
38
38
  'page.eftpos-pay.text.manual.tip': string;
39
39
  'page.eftpos-pay.text.manual.cancel': string;
40
+ 'page.eftpos-pay.text.manual.print_receipt': string;
40
41
  'page.eftpos-pay.text.modify.payment.info': (mode: string) => "Modify payment info" | "Modify refund information";
41
42
  'page.eftpos-pay.text.successful': (mode: string) => string;
42
43
  'page.eftpos-pay.text.failed': (mode: string) => string;
@@ -85,6 +86,7 @@ declare const _default: {
85
86
  'page.eftpos-pay.text.transaction.eftpos.fail.device': string;
86
87
  'page.eftpos-pay.text.transaction.eftpos.fail.network': string;
87
88
  'page.eftpos-pay.text.transaction.eftpos.fail.if': (mode: string) => "If you have confirmed the payment status of this order, please click on Manual marking." | "If you have confirmed the refund status of this order, please click on Manual Marking.";
89
+ 'page.eftpos-pay.text.transaction.eftpos.fail.other': string;
88
90
  'page.eftpos-pay.text.application': string;
89
91
  'page.eftpos-pay.text.approved': string;
90
92
  'page.eftpos-pay.text.device.no.title': string;
@@ -139,6 +141,7 @@ declare const _default: {
139
141
  'page.eftpos-pay.text.manual.diff': string;
140
142
  'page.eftpos-pay.text.manual.tip': string;
141
143
  'page.eftpos-pay.text.manual.cancel': string;
144
+ 'page.eftpos-pay.text.manual.print_receipt': string;
142
145
  'page.eftpos-pay.text.modify.payment.info': (mode: string) => "修改支付信息" | "修改退款信息";
143
146
  'page.eftpos-pay.text.successful': (mode: string) => string;
144
147
  'page.eftpos-pay.text.failed': (mode: string) => string;
@@ -187,6 +190,7 @@ declare const _default: {
187
190
  'page.eftpos-pay.text.transaction.eftpos.fail.device': string;
188
191
  'page.eftpos-pay.text.transaction.eftpos.fail.network': string;
189
192
  'page.eftpos-pay.text.transaction.eftpos.fail.if': (mode: string) => "如果您已确认此交易的付款状态,请点击手动标记" | "如果您已确认此订单的退款状态,请点击手动标记。";
193
+ 'page.eftpos-pay.text.transaction.eftpos.fail.other': string;
190
194
  'page.eftpos-pay.text.application': string;
191
195
  'page.eftpos-pay.text.approved': string;
192
196
  'page.eftpos-pay.text.device.no.title': string;
@@ -241,6 +245,7 @@ declare const _default: {
241
245
  'page.eftpos-pay.text.manual.diff': string;
242
246
  'page.eftpos-pay.text.manual.tip': string;
243
247
  'page.eftpos-pay.text.manual.cancel': string;
248
+ 'page.eftpos-pay.text.manual.print_receipt': string;
244
249
  'page.eftpos-pay.text.modify.payment.info': (mode: string) => "修改支付信息" | "修改退款信息";
245
250
  'page.eftpos-pay.text.successful': (mode: string) => string;
246
251
  'page.eftpos-pay.text.failed': (mode: string) => string;
@@ -289,6 +294,7 @@ declare const _default: {
289
294
  'page.eftpos-pay.text.transaction.eftpos.fail.device': string;
290
295
  'page.eftpos-pay.text.transaction.eftpos.fail.network': string;
291
296
  'page.eftpos-pay.text.transaction.eftpos.fail.if': (mode: string) => "如果您已確認此交易的付款狀態,請點擊手動標記" | "如果您已確認此訂單的退款狀態,請點擊手動標記。";
297
+ 'page.eftpos-pay.text.transaction.eftpos.fail.other': string;
292
298
  'page.eftpos-pay.text.application': string;
293
299
  'page.eftpos-pay.text.approved': string;
294
300
  'page.eftpos-pay.text.device.no.title': string;
@@ -59,6 +59,7 @@ export default {
59
59
  'page.eftpos-pay.text.manual.diff': "If it doesn't match, please enter the actual transaction amount in the input box below.",
60
60
  'page.eftpos-pay.text.manual.tip': "Amount tendered (incl. surcharge)",
61
61
  'page.eftpos-pay.text.manual.cancel': 'Cancel current transaction',
62
+ 'page.eftpos-pay.text.manual.print_receipt': 'Print Receipt',
62
63
  'page.eftpos-pay.text.modify.payment.info': function pageEftposPayTextModifyPaymentInfo(mode) {
63
64
  return mode === 'pay' || mode === 'fullPay' ? 'Modify payment info' : 'Modify refund information';
64
65
  },
@@ -120,6 +121,7 @@ export default {
120
121
  'page.eftpos-pay.text.transaction.eftpos.fail.if': function pageEftposPayTextTransactionEftposFailIf(mode) {
121
122
  return mode === 'pay' || mode === 'fullPay' ? 'If you have confirmed the payment status of this order, please click on Manual marking.' : 'If you have confirmed the refund status of this order, please click on Manual Marking.';
122
123
  },
124
+ 'page.eftpos-pay.text.transaction.eftpos.fail.other': 'Payment issue detected. Please print the receipt and contact staff for assistance.',
123
125
  'page.eftpos-pay.text.application': 'Waiting for customer to select application',
124
126
  'page.eftpos-pay.text.approved': 'Approved',
125
127
  'page.eftpos-pay.text.device.no.title': 'No devices added yet. Please add devices to proceed.',
@@ -204,6 +206,7 @@ export default {
204
206
  'page.eftpos-pay.text.manual.diff': "如不一致请在下方输入框内输入真实的交易金额。",
205
207
  'page.eftpos-pay.text.manual.tip': "实付金额(含附加费)",
206
208
  'page.eftpos-pay.text.manual.cancel': '取消当前交易',
209
+ 'page.eftpos-pay.text.manual.print_receipt': '打印收据',
207
210
  'page.eftpos-pay.text.modify.payment.info': function pageEftposPayTextModifyPaymentInfo(mode) {
208
211
  return mode === 'pay' || mode === 'fullPay' ? '修改支付信息' : '修改退款信息';
209
212
  },
@@ -273,6 +276,7 @@ export default {
273
276
  'page.eftpos-pay.text.transaction.eftpos.fail.if': function pageEftposPayTextTransactionEftposFailIf(mode) {
274
277
  return mode === 'pay' || mode === 'fullPay' ? '如果您已确认此交易的付款状态,请点击手动标记' : '如果您已确认此订单的退款状态,请点击手动标记。';
275
278
  },
279
+ 'page.eftpos-pay.text.transaction.eftpos.fail.other': '刷卡机支付出现问题,请打印收据后联系店员处理。',
276
280
  'page.eftpos-pay.text.application': '等待客户选择应用',
277
281
  'page.eftpos-pay.text.approved': '已接受',
278
282
  'page.eftpos-pay.text.device.no.title': '您还没有添加任何设备。请添加设备后使用',
@@ -495,6 +499,7 @@ export default {
495
499
  'page.eftpos-pay.text.manual.diff': "如不一致請在下方輸入框內輸入真實的交易金額。",
496
500
  'page.eftpos-pay.text.manual.tip': "實付金額(含附加費)",
497
501
  'page.eftpos-pay.text.manual.cancel': '取消當前交易',
502
+ 'page.eftpos-pay.text.manual.print_receipt': '打印收據',
498
503
  'page.eftpos-pay.text.modify.payment.info': function pageEftposPayTextModifyPaymentInfo(mode) {
499
504
  return mode === 'pay' || mode === 'fullPay' ? '修改支付信息' : '修改退款信息';
500
505
  },
@@ -564,6 +569,7 @@ export default {
564
569
  'page.eftpos-pay.text.transaction.eftpos.fail.if': function pageEftposPayTextTransactionEftposFailIf(mode) {
565
570
  return mode === 'pay' || mode === 'fullPay' ? '如果您已確認此交易的付款狀態,請點擊手動標記' : '如果您已確認此訂單的退款狀態,請點擊手動標記。';
566
571
  },
572
+ 'page.eftpos-pay.text.transaction.eftpos.fail.other': '刷卡機支付出現問題,請打印收據後聯繫店員處理。',
567
573
  'page.eftpos-pay.text.application': '等待客户選擇應用',
568
574
  'page.eftpos-pay.text.approved': '已接受',
569
575
  'page.eftpos-pay.text.device.no.title': '您還沒有添加任何設備。請添加設備後使用',
@@ -7,14 +7,15 @@ import './index.less';
7
7
  * @Author: hongbing.wang
8
8
  * @Date: 2024-08-20 14:59
9
9
  */
10
- declare const Pay: ({ api, onChange: onChangeStatus, className, terminal, net, isIpad, tyroUrl, tyroVersion, formatAmount, }: PayProps & {
10
+ declare const Pay: ({ api, onChange: onChangeStatus, className, terminal, net, isMobile, tyroUrl, tyroVersion, formatAmount, client }: PayProps & {
11
11
  terminal: {
12
12
  network: boolean;
13
13
  };
14
14
  net: boolean;
15
- isIpad: boolean;
15
+ isMobile: boolean;
16
16
  tyroUrl?: string | undefined;
17
17
  tyroVersion?: string | undefined;
18
18
  formatAmount(amount: number | string, precision: number, symbol: string): string;
19
+ client: string;
19
20
  }) => React.JSX.Element;
20
21
  export default Pay;
@@ -9,7 +9,7 @@ import Header from "./component/header";
9
9
  import { getPayParams } from "./helper";
10
10
  import Manual from "./component/manual";
11
11
  import Signature from "./component/signature";
12
- import { StatusEnum, PayRouteEnum } from "./const";
12
+ import { StatusEnum, PayRouteEnum, ClientEnum } from "./const";
13
13
  import { Payo, Windcave, Tyro } from "./manufacturer";
14
14
  import { useContextData, useDispatch, updateStatus, backUpProduction, updateComponent, backUpFree, updateState } from "./store";
15
15
  import "./index.less";
@@ -35,13 +35,14 @@ var Pay = function Pay(_ref) {
35
35
  className = _ref.className,
36
36
  terminal = _ref.terminal,
37
37
  net = _ref.net,
38
- isIpad = _ref.isIpad,
38
+ isMobile = _ref.isMobile,
39
39
  tyroUrl = _ref.tyroUrl,
40
40
  tyroVersion = _ref.tyroVersion,
41
41
  _ref$formatAmount = _ref.formatAmount,
42
42
  formatAmount = _ref$formatAmount === void 0 ? function (number, precision, symbol) {
43
43
  return "".concat(symbol).concat(number);
44
- } : _ref$formatAmount;
44
+ } : _ref$formatAmount,
45
+ client = _ref.client;
45
46
  var data = useContextData();
46
47
  var dataRef = useRef(data);
47
48
  // console.log("pay = ",'pay')
@@ -67,11 +68,11 @@ var Pay = function Pay(_ref) {
67
68
  * @Author: hongbing.wang
68
69
  * @Date: 2024-08-20 15:00
69
70
  */
70
- var onChange = useCallback(function (status, params) {
71
+ var onChange = useCallback(function (status, params, other) {
71
72
  if (status === StatusEnum.Success || status === StatusEnum.Fail) {
72
73
  dispatch(updateStatus(status));
73
74
  }
74
- onChangeStatus(status, params);
75
+ onChangeStatus(status, params, other);
75
76
  }, [dispatch, onChangeStatus]);
76
77
 
77
78
  // 主流程 已完成 的崩溃恢复
@@ -162,7 +163,7 @@ var Pay = function Pay(_ref) {
162
163
  }), data.eftpos === 'payo' ? /*#__PURE__*/React.createElement(Payo, {
163
164
  api: api,
164
165
  onChange: onChange
165
- }, data.warn && data.status !== StatusEnum.Success ? /*#__PURE__*/React.createElement("div", {
166
+ }, data.warn && data.status !== StatusEnum.Success && client === ClientEnum.Merchant ? /*#__PURE__*/React.createElement("div", {
166
167
  className: "pisell-lowcode__eft-pay-step-item pisell-lowcode__eft-pay-step-item-warn"
167
168
  }, data.warn) : null, data.status === StatusEnum.Success ? /*#__PURE__*/React.createElement("div", {
168
169
  className: "pisell-lowcode__eft-pay-step-item pisell-lowcode__eft-pay-step-item-tip"
@@ -181,7 +182,7 @@ var Pay = function Pay(_ref) {
181
182
  onChange: onChange,
182
183
  api: api,
183
184
  className: className,
184
- isIpad: isIpad,
185
+ isMobile: isMobile,
185
186
  formatAmount: formatAmount
186
187
  }) : null);
187
188
  };
@@ -8,4 +8,6 @@ export declare const POS: ({ api, onChange, }: {
8
8
  [keys: string]: unknown;
9
9
  } | undefined) => void;
10
10
  }) => React.JSX.Element;
11
- export declare const Action: () => React.JSX.Element;
11
+ export declare const Action: ({ onChange }: {
12
+ onChange: any;
13
+ }) => React.JSX.Element;
@@ -22,7 +22,7 @@ import { locales } from '@pisell/utils';
22
22
  import { Button } from 'antd';
23
23
  import React, { useEffect, useRef } from 'react';
24
24
  import Step from "../component/step";
25
- import { PayStatus, StatusEnum, ModeEnum } from "../const";
25
+ import { PayStatus, StatusEnum, ModeEnum, ClientEnum } from "../const";
26
26
  import { getUuid, getPayParams } from "../helper";
27
27
  import { useFail, useStoreRef } from "../hooks";
28
28
  import { useContextData, useDispatch, updateNextStep, updateComponent, updateState, updateCustom } from "../store";
@@ -48,7 +48,7 @@ export var POS = function POS(_ref) {
48
48
  var _steps$ = steps[0],
49
49
  key = _steps$.key,
50
50
  props = _objectWithoutProperties(_steps$, _excluded);
51
- var fail = useFail(0, true);
51
+ var fail = useFail(0);
52
52
  var failRef = useRef(fail);
53
53
  var controllerRef = useRef();
54
54
  var clearRef = useRef();
@@ -108,13 +108,13 @@ export var POS = function POS(_ref) {
108
108
  success(res);
109
109
  return;
110
110
  }
111
- failRef.current(res);
111
+ failRef.current(res, true);
112
112
  }, function (res) {
113
113
  // 无网 或 已卸载 则不进行处理
114
114
  if (unloadRef.current || !netRef.current) {
115
115
  return;
116
116
  }
117
- failRef.current(res);
117
+ failRef.current(res, true);
118
118
  });
119
119
  };
120
120
 
@@ -180,7 +180,7 @@ export var POS = function POS(_ref) {
180
180
  checkApi();
181
181
  return;
182
182
  }
183
- failRef.current(err);
183
+ failRef.current(err, true);
184
184
  });
185
185
  }, [api, check, dispatch, onChange]);
186
186
  useEffect(function () {
@@ -195,10 +195,12 @@ export var POS = function POS(_ref) {
195
195
  }, []);
196
196
  return /*#__PURE__*/React.createElement(Step, props);
197
197
  };
198
- export var Action = function Action() {
198
+ export var Action = function Action(_ref2) {
199
+ var onChange = _ref2.onChange;
199
200
  var dispatch = useDispatch();
200
201
  var _useContextData2 = useContextData(),
201
- mode = _useContextData2.mode;
202
+ mode = _useContextData2.mode,
203
+ client = _useContextData2.client;
202
204
 
203
205
  /**
204
206
  * @title: 前往手动标记页
@@ -216,9 +218,9 @@ export var Action = function Action() {
216
218
  };
217
219
  return /*#__PURE__*/React.createElement("div", {
218
220
  className: "pisell-lowcode__eft-pay-step-item-btns"
219
- }, /*#__PURE__*/React.createElement(Button, {
221
+ }, client === ClientEnum.Merchant ? /*#__PURE__*/React.createElement(Button, {
220
222
  block: true,
221
223
  className: "pisell-lowcode__eft-pay-step-item-btn",
222
224
  onClick: onManually
223
- }, locales.getText('page.eftpos-pay.text.manual.marking')));
225
+ }, locales.getText('page.eftpos-pay.text.manual.marking')) : null);
224
226
  };
@@ -1,5 +1,5 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _excluded = ["order_id", "name", "symbol", "amount", "mode", "number", "pay", "device", "net"];
2
+ var _excluded = ["order_id", "name", "symbol", "amount", "mode", "number", "pay", "device", "net", "client"];
3
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -8,7 +8,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
8
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
10
  import { locales } from '@pisell/utils';
11
- import { EftposEnum, StatusEnum, PayRouteEnum, ModeEnum } from "../const";
11
+ import { EftposEnum, StatusEnum, PayRouteEnum, ModeEnum, ClientEnum } from "../const";
12
12
  /**
13
13
  * @title: payo 步骤信息
14
14
  * @description:
@@ -50,6 +50,7 @@ export default (function (params) {
50
50
  pay = _ref.pay,
51
51
  device = _ref.device,
52
52
  net = _ref.net,
53
+ client = _ref.client,
53
54
  other = _objectWithoutProperties(_ref, _excluded);
54
55
  return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
55
56
  order_id: order_id,
@@ -67,6 +68,7 @@ export default (function (params) {
67
68
  status: StatusEnum.Loading,
68
69
  steps: getStep(mode),
69
70
  render: true,
71
+ client: client !== 'undefined' ? client : ClientEnum.Merchant,
70
72
  custom: other || {}
71
73
  }, typeof net !== 'undefined' ? {
72
74
  net: net
@@ -31,5 +31,7 @@ export default (function (_ref) {
31
31
  onChange: onChange
32
32
  });
33
33
  }
34
- }), children), data.status !== StatusEnum.Success ? /*#__PURE__*/React.createElement(Action, null) : null);
34
+ }), children), data.status !== StatusEnum.Success ? /*#__PURE__*/React.createElement(Action, {
35
+ onChange: onChange
36
+ }) : null);
35
37
  });
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { DeviceStatusType, StatusType, ModeType, RouteType } from '../const';
2
+ import { DeviceStatusType, StatusType, ModeType, RouteType, ClientEnum } from '../const';
3
3
  import { ThunkDispatch } from './useThunkReducer';
4
4
  export declare enum EActionTypes {
5
5
  UPDATE_INIT = "UPDATE_INIT",
@@ -16,7 +16,8 @@ export declare enum EActionTypes {
16
16
  UPDATE_STEP_CURRENT_ITEM_CUSTOM = "UPDATE_STEP_CURRENT_ITEM_CUSTOM",
17
17
  UPDATE_STEP_ITEM = "UPDATE_STEP_ITEM",
18
18
  BACKUP_PRODUCTION = "BACKUP_PRODUCTION",
19
- BACKUP_FREE = "BACKUP_FREE"
19
+ BACKUP_FREE = "BACKUP_FREE",
20
+ UPDATE_CLIENT = "UPDATE_CLIENT"
20
21
  }
21
22
  export declare type State = {
22
23
  /** 支付名称 */
@@ -89,6 +90,7 @@ export declare type State = {
89
90
  money?: number;
90
91
  };
91
92
  backup?: Omit<State, 'backup'>;
93
+ client: ClientEnum;
92
94
  };
93
95
  export declare type Action = {
94
96
  type: EActionTypes;
@@ -258,6 +260,18 @@ export declare const updateCurrentStemItem: (payload: any) => {
258
260
  type: EActionTypes;
259
261
  payload: any;
260
262
  };
263
+ /**
264
+ * @title: 更新当前步骤信息
265
+ * @description: 更新当前步骤信息
266
+ * @Author: hongbing.wang
267
+ * @Date: 2024-08-19 10:09
268
+ */
269
+ export declare const updateClient: (payload: ClientEnum) => {
270
+ type: EActionTypes;
271
+ payload: {
272
+ client: ClientEnum;
273
+ };
274
+ };
261
275
  /**
262
276
  * @title: 更新备份信息
263
277
  * @description: 更新备份信息
@@ -329,6 +343,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
329
343
  money?: number | undefined;
330
344
  } | undefined;
331
345
  backup?: Omit<State, "backup"> | undefined;
346
+ client?: ClientEnum | undefined;
332
347
  };
333
348
  };
334
349
  export declare function reducers(state: State, action: Action): State;
@@ -37,6 +37,7 @@ export var EActionTypes;
37
37
  EActionTypes["UPDATE_STEP_ITEM"] = "UPDATE_STEP_ITEM";
38
38
  EActionTypes["BACKUP_PRODUCTION"] = "BACKUP_PRODUCTION";
39
39
  EActionTypes["BACKUP_FREE"] = "BACKUP_FREE";
40
+ EActionTypes["UPDATE_CLIENT"] = "UPDATE_CLIENT";
40
41
  })(EActionTypes || (EActionTypes = {}));
41
42
  /**
42
43
  * @title: 刷新 key
@@ -207,6 +208,21 @@ export var updateCurrentStemItem = function updateCurrentStemItem(payload) {
207
208
  };
208
209
  };
209
210
 
211
+ /**
212
+ * @title: 更新当前步骤信息
213
+ * @description: 更新当前步骤信息
214
+ * @Author: hongbing.wang
215
+ * @Date: 2024-08-19 10:09
216
+ */
217
+ export var updateClient = function updateClient(payload) {
218
+ return {
219
+ type: EActionTypes.UPDATE_CLIENT,
220
+ payload: {
221
+ client: payload
222
+ }
223
+ };
224
+ };
225
+
210
226
  /**
211
227
  * @title: 更新备份信息
212
228
  * @description: 更新备份信息
@@ -321,6 +337,10 @@ export function reducers(state, action) {
321
337
  }
322
338
  var s = Object.assign({}, (_objectDestructuringEmpty(state.backup), state.backup));
323
339
  return _objectSpread(_objectSpread({}, s), action.payload);
340
+ case EActionTypes.UPDATE_CLIENT:
341
+ return _objectSpread(_objectSpread({}, state), {}, {
342
+ client: action.payload['client']
343
+ });
324
344
  default:
325
345
  {
326
346
  throw new Error("Unhandled action type: ".concat(action.type));
@@ -1,5 +1,5 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _excluded = ["order_id", "name", "symbol", "amount", "mode", "number", "pay", "device", "net"];
2
+ var _excluded = ["order_id", "name", "symbol", "amount", "mode", "number", "pay", "device", "net", "client"];
3
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -8,7 +8,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
8
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
10
  import { locales } from '@pisell/utils';
11
- import { EftposEnum, StatusEnum, PayRouteEnum, ModeEnum } from "../const";
11
+ import { EftposEnum, StatusEnum, PayRouteEnum, ModeEnum, ClientEnum } from "../const";
12
12
  /**
13
13
  * @title: 初始化 tyro 数据
14
14
  * @Author: hongbing.wang
@@ -27,6 +27,7 @@ export default (function (params) {
27
27
  pay = _ref.pay,
28
28
  device = _ref.device,
29
29
  net = _ref.net,
30
+ client = _ref.client,
30
31
  other = _objectWithoutProperties(_ref, _excluded);
31
32
  return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
32
33
  name: name,
@@ -44,6 +45,7 @@ export default (function (params) {
44
45
  status: StatusEnum.Loading,
45
46
  steps: [],
46
47
  render: true,
48
+ client: client !== 'undefined' ? client : ClientEnum.Merchant,
47
49
  custom: other || {}
48
50
  }, typeof net !== 'undefined' ? {
49
51
  net: net
@@ -19,7 +19,7 @@ import { useTyro } from "./hooks";
19
19
  import { locales } from '@pisell/utils';
20
20
  import { Button } from 'antd';
21
21
  import { useDispatch, useContextData, updateState, updateCustom, updateComponent } from "../store";
22
- import { ModeEnum } from "../const";
22
+ import { ModeEnum, ClientEnum } from "../const";
23
23
  import { Decimal } from 'decimal.js';
24
24
  import { getUuid, getPayParams } from "../helper";
25
25
  import Step from "../component/step/step";
@@ -35,7 +35,8 @@ export default (function (_ref) {
35
35
  eftpos = _useContextData.eftpos,
36
36
  custom = _useContextData.custom,
37
37
  mode = _useContextData.mode,
38
- payStatus = _useContextData.status;
38
+ payStatus = _useContextData.status,
39
+ client = _useContextData.client;
39
40
  var dispatch = useDispatch();
40
41
  var _useState = useState(-1),
41
42
  _useState2 = _slicedToArray(_useState, 2),
@@ -64,11 +65,15 @@ export default (function (_ref) {
64
65
  var requestParams = useRef(custom === null || custom === void 0 ? void 0 : custom.requestParams);
65
66
  var listRef = useRef((custom === null || custom === void 0 ? void 0 : custom.list) || []);
66
67
  var iClientRef = useRef();
68
+ var requestIdRef = useRef((custom === null || custom === void 0 ? void 0 : custom.requestId) || '');
67
69
  var unloadRef = useRef(false);
68
70
  var clearRef = useRef();
69
71
  useEffect(function () {
70
72
  listRef.current = (custom === null || custom === void 0 ? void 0 : custom.list) || [];
71
73
  }, [custom === null || custom === void 0 ? void 0 : custom.list]);
74
+ useEffect(function () {
75
+ requestIdRef.current = (custom === null || custom === void 0 ? void 0 : custom.requestId) || '';
76
+ }, [custom === null || custom === void 0 ? void 0 : custom.requestId]);
72
77
  useEffect(function () {
73
78
  requestParams.current = custom === null || custom === void 0 ? void 0 : custom.requestParams;
74
79
  }, [custom === null || custom === void 0 ? void 0 : custom.requestParams]);
@@ -112,7 +117,7 @@ export default (function (_ref) {
112
117
  * @Date: 2024-08-19 11:32
113
118
  */
114
119
  var refundOrder = function refundOrder() {
115
- var _deviceRef$current, _deviceRef$current$se;
120
+ var _deviceRef$current, _deviceRef$current$se, _deviceRef$current2;
116
121
  var iClient = iClientRef.current;
117
122
  if (!iClient) {
118
123
  return;
@@ -142,6 +147,26 @@ export default (function (_ref) {
142
147
  }));
143
148
  setStatus(Date.now());
144
149
  merchantReceiptRef.current = {};
150
+ // 退款 记录
151
+ api.addTransaction({
152
+ order_id: orderIdRef.current,
153
+ number: numRef.current,
154
+ card_reader_id: (_deviceRef$current2 = deviceRef.current) === null || _deviceRef$current2 === void 0 ? void 0 : _deviceRef$current2.id,
155
+ card_reader_type: eftpos,
156
+ amount: requestParams.current.amount,
157
+ action: modeRef.current === ModeEnum.FullPay ? ModeEnum.Pay : modeRef.current,
158
+ status: 'pending',
159
+ request: requestParams.current,
160
+ response: {},
161
+ metadata: {
162
+ receipt: []
163
+ }
164
+ }).then(function (res) {
165
+ requestIdRef.current = res.data.id;
166
+ dispatch(updateCustom({
167
+ requestId: res.data.id
168
+ }));
169
+ });
145
170
  iClient.initiateRefund(requestParams.current, {
146
171
  receiptCallback: receiptCallbackImpl,
147
172
  transactionCompleteCallback: transactionCompleteCallbackImpl,
@@ -158,7 +183,7 @@ export default (function (_ref) {
158
183
  * @Date: 2024-08-19 11:33
159
184
  */
160
185
  var payOrder = function payOrder() {
161
- var _deviceRef$current2, _deviceRef$current2$s, _payRef$current, _deviceRef$current3, _deviceRef$current3$s, _deviceRef$current4, _deviceRef$current4$s;
186
+ var _deviceRef$current3, _deviceRef$current3$s, _payRef$current, _deviceRef$current4, _deviceRef$current4$s, _deviceRef$current5, _deviceRef$current5$s, _deviceRef$current6;
162
187
  var iClient = iClientRef.current;
163
188
  if (!iClient) {
164
189
  return;
@@ -174,14 +199,14 @@ export default (function (_ref) {
174
199
  dispatch(updateState({
175
200
  number: numRef.current
176
201
  }));
177
- console.log('deviceRef.current?.settings?.useOriginSurcharge = ', (_deviceRef$current2 = deviceRef.current) === null || _deviceRef$current2 === void 0 ? void 0 : (_deviceRef$current2$s = _deviceRef$current2.setting) === null || _deviceRef$current2$s === void 0 ? void 0 : _deviceRef$current2$s.useOriginSurcharge);
202
+ console.log('deviceRef.current?.settings?.useOriginSurcharge = ', (_deviceRef$current3 = deviceRef.current) === null || _deviceRef$current3 === void 0 ? void 0 : (_deviceRef$current3$s = _deviceRef$current3.setting) === null || _deviceRef$current3$s === void 0 ? void 0 : _deviceRef$current3$s.useOriginSurcharge);
178
203
  // (deviceRef.current?.setting as { receipts?: boolean })
179
204
  requestParams.current = {
180
205
  amount: new Decimal((_payRef$current = payRef.current) === null || _payRef$current === void 0 ? void 0 : _payRef$current.total).mul(100).toFixed(0, Decimal.ROUND_HALF_UP),
181
206
  // 手续费 true tyro 手续费, false 系统手续费
182
- enableSurcharge: ((_deviceRef$current3 = deviceRef.current) === null || _deviceRef$current3 === void 0 ? void 0 : (_deviceRef$current3$s = _deviceRef$current3.setting) === null || _deviceRef$current3$s === void 0 ? void 0 : _deviceRef$current3$s.useOriginSurcharge) || false,
207
+ enableSurcharge: ((_deviceRef$current4 = deviceRef.current) === null || _deviceRef$current4 === void 0 ? void 0 : (_deviceRef$current4$s = _deviceRef$current4.setting) === null || _deviceRef$current4$s === void 0 ? void 0 : _deviceRef$current4$s.useOriginSurcharge) || false,
183
208
  // 打印小票 true 打印到系统上 false 打印到pos机上
184
- integratedReceipt: !((_deviceRef$current4 = deviceRef.current) !== null && _deviceRef$current4 !== void 0 && (_deviceRef$current4$s = _deviceRef$current4.setting) !== null && _deviceRef$current4$s !== void 0 && _deviceRef$current4$s.receipts),
209
+ integratedReceipt: !((_deviceRef$current5 = deviceRef.current) !== null && _deviceRef$current5 !== void 0 && (_deviceRef$current5$s = _deviceRef$current5.setting) !== null && _deviceRef$current5$s !== void 0 && _deviceRef$current5$s.receipts),
185
210
  integrationKey: integrationKey,
186
211
  transactionId: numRef.current,
187
212
  mid: mid,
@@ -192,6 +217,26 @@ export default (function (_ref) {
192
217
  }));
193
218
  setStatus(Date.now());
194
219
  merchantReceiptRef.current = {};
220
+ // 支付 记录
221
+ api.addTransaction({
222
+ order_id: orderIdRef.current,
223
+ number: numRef.current,
224
+ card_reader_id: (_deviceRef$current6 = deviceRef.current) === null || _deviceRef$current6 === void 0 ? void 0 : _deviceRef$current6.id,
225
+ card_reader_type: eftpos,
226
+ amount: requestParams.current.amount,
227
+ action: modeRef.current === ModeEnum.FullPay ? ModeEnum.Pay : modeRef.current,
228
+ status: 'pending',
229
+ request: requestParams.current,
230
+ response: {},
231
+ metadata: {
232
+ receipt: []
233
+ }
234
+ }).then(function (res) {
235
+ requestIdRef.current = res.data.id;
236
+ dispatch(updateCustom({
237
+ requestId: res.data.id
238
+ }));
239
+ });
195
240
  iClient.initiatePurchase(requestParams.current, {
196
241
  receiptCallback: receiptCallbackImpl,
197
242
  transactionCompleteCallback: transactionCompleteCallbackImpl,
@@ -215,6 +260,7 @@ export default (function (_ref) {
215
260
  }
216
261
  setStatus(Date.now());
217
262
  merchantReceiptRef.current = {};
263
+ // 恢复 记录
218
264
  iClient.continueLastTransaction({
219
265
  receiptCallback: receiptCallbackImpl,
220
266
  transactionCompleteCallback: transactionCompleteCallbackImpl,
@@ -235,12 +281,10 @@ export default (function (_ref) {
235
281
  merchantReceipt = _ref3.merchantReceipt;
236
282
  console.log('商家小票 客户端是否打印小票 = ', signatureRequired);
237
283
  console.log('商家小票 小票内容 = \n', merchantReceipt);
238
- // if (signatureRequired) {
239
284
  var receipt = [merchantReceipt].filter(function (item) {
240
285
  return typeof item === 'string';
241
286
  }).filter(Boolean);
242
287
  onChange('print', receipt);
243
- // }
244
288
  merchantReceiptRef.current = {
245
289
  signatureRequired: signatureRequired,
246
290
  merchantReceipt: merchantReceipt
@@ -329,7 +373,7 @@ export default (function (_ref) {
329
373
  * @Date: 2024-08-19 11:35
330
374
  */
331
375
  var transactionCompleteCallbackImpl = function transactionCompleteCallbackImpl(response) {
332
- var _deviceRef$current5;
376
+ var _deviceRef$current7;
333
377
  setStatus(-1);
334
378
  setManually(false);
335
379
  console.log('Response = ' + JSON.stringify(response), ', Request = ', JSON.stringify(requestParams.current));
@@ -338,15 +382,15 @@ export default (function (_ref) {
338
382
  response === null || response === void 0 ? void 0 : response.customerReceipt].filter(function (item) {
339
383
  return typeof item === 'string';
340
384
  }).filter(Boolean);
341
- api.addTransaction({
385
+ api.editTransaction(requestIdRef.current, {
342
386
  order_id: orderIdRef.current,
343
387
  number: numRef.current,
344
- card_reader_id: (_deviceRef$current5 = deviceRef.current) === null || _deviceRef$current5 === void 0 ? void 0 : _deviceRef$current5.id,
388
+ card_reader_id: (_deviceRef$current7 = deviceRef.current) === null || _deviceRef$current7 === void 0 ? void 0 : _deviceRef$current7.id,
345
389
  card_reader_type: eftpos,
346
390
  amount: requestParams.current.amount,
347
391
  action: modeRef.current === ModeEnum.FullPay ? ModeEnum.Pay : modeRef.current,
348
- status: response.result === 'APPROVED' ? 'succeed' : 'failed',
349
392
  request: requestParams.current,
393
+ status: response.result === 'APPROVED' ? 'succeed' : 'failed',
350
394
  response: _objectSpread(_objectSpread({}, response), {}, {
351
395
  merchantReceipt: merchantReceiptRef.current
352
396
  }),
@@ -369,7 +413,7 @@ export default (function (_ref) {
369
413
  card_reader_surcharge: response.surchargeAmount || 0
370
414
  }));
371
415
  clearRef.current = setTimeout(function () {
372
- var _deviceRef$current6;
416
+ var _deviceRef$current8;
373
417
  var params = getPayParams({
374
418
  mode: modeRef.current,
375
419
  amount: amountRef.current,
@@ -382,13 +426,13 @@ export default (function (_ref) {
382
426
  }
383
427
  }, 'success');
384
428
  onChange('success', _objectSpread(_objectSpread({}, params), {}, {
385
- receipt: (_deviceRef$current6 = deviceRef.current) !== null && _deviceRef$current6 !== void 0 && _deviceRef$current6.setting.receipts ? [] : receipt
429
+ receipt: (_deviceRef$current8 = deviceRef.current) !== null && _deviceRef$current8 !== void 0 && _deviceRef$current8.setting.receipts ? [] : receipt
386
430
  }));
387
431
  }, 1000);
388
432
  return;
389
433
  } else {
390
- var _deviceRef$current7;
391
- var current = (_deviceRef$current7 = deviceRef.current) !== null && _deviceRef$current7 !== void 0 && _deviceRef$current7.setting.receipts ? [] : receipt;
434
+ var _deviceRef$current9;
435
+ var current = (_deviceRef$current9 = deviceRef.current) !== null && _deviceRef$current9 !== void 0 && _deviceRef$current9.setting.receipts ? [] : receipt;
392
436
  if (current.length > 0) {
393
437
  onChange('print', current);
394
438
  }
@@ -447,6 +491,9 @@ export default (function (_ref) {
447
491
  }
448
492
  }
449
493
  }, [load]);
494
+ var onNotin = function onNotin() {
495
+ onChange('print', [], 'print_on_timeout');
496
+ };
450
497
  useEffect(function () {
451
498
  var clear;
452
499
  if (status === -1) {
@@ -485,7 +532,6 @@ export default (function (_ref) {
485
532
  }
486
533
  console.log('倒计时到了');
487
534
  setManually(true);
488
- // iClient.cancelCurrentTransaction();
489
535
  }, Minute);
490
536
  return function () {
491
537
  if (clear) {
@@ -559,11 +605,15 @@ export default (function (_ref) {
559
605
  });
560
606
  })), isManually ? /*#__PURE__*/React.createElement("div", {
561
607
  className: "pisell-lowcode__eft-pay-step-item-btns"
562
- }, /*#__PURE__*/React.createElement(Button, {
608
+ }, client === ClientEnum.Merchant ? /*#__PURE__*/React.createElement(Button, {
563
609
  block: true,
564
610
  className: "pisell-lowcode__eft-pay-step-item-btn",
565
611
  onClick: onManually
566
- }, locales.getText('page.eftpos-pay.text.manual.marking'))) : null, /*#__PURE__*/React.createElement("div", {
612
+ }, locales.getText('page.eftpos-pay.text.manual.marking')) : /*#__PURE__*/React.createElement(Button, {
613
+ block: true,
614
+ className: "pisell-lowcode__eft-pay-step-item-btn",
615
+ onClick: onNotin
616
+ }, locales.getText('page.eftpos-pay.text.manual.print_receipt'))) : null, /*#__PURE__*/React.createElement("div", {
567
617
  className: "pisell-lowcode__eft-pay-step-item-btns",
568
618
  style: {
569
619
  flexWrap: 'wrap'