@pisell/private-materials 6.3.79 → 6.3.80

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 (151) 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.css +1 -1
  6. package/build/lowcode/render/default/view.js +9 -9
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +9 -9
  9. package/es/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
  10. package/es/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  11. package/es/components/appointmentBooking/components/Footer/index.d.ts +0 -1
  12. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -1
  13. package/es/components/booking/forms/footer.d.ts +0 -1
  14. package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  15. package/es/components/booking/hooks/useClearCart.d.ts +0 -1
  16. package/es/components/booking/info/date/index.d.ts +1 -0
  17. package/es/components/booking/info/dateRange/index.d.ts +0 -1
  18. package/es/components/eftpos/const.d.ts +3 -1
  19. package/es/components/eftpos/const.js +2 -0
  20. package/es/components/eftpos/device.d.ts +3 -1
  21. package/es/components/eftpos/device.js +5 -3
  22. package/es/components/eftpos/index.d.ts +0 -1
  23. package/es/components/eftpos/index.js +34 -11
  24. package/es/components/eftpos/index.less +26 -1
  25. package/es/components/eftpos/locales.d.ts +3 -0
  26. package/es/components/eftpos/locales.js +3 -0
  27. package/es/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +6 -0
  28. package/es/components/eftposPay/aggregatePayment/hooks/usePayment.js +125 -0
  29. package/es/components/eftposPay/aggregatePayment/index.d.ts +3 -0
  30. package/es/components/eftposPay/aggregatePayment/index.js +3 -0
  31. package/es/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
  32. package/es/components/eftposPay/aggregatePayment/mock.js +567 -0
  33. package/es/components/eftposPay/aggregatePayment/service.d.ts +24 -0
  34. package/es/components/eftposPay/aggregatePayment/service.js +70 -0
  35. package/es/components/eftposPay/aggregatePayment/types.d.ts +96 -0
  36. package/es/components/eftposPay/aggregatePayment/types.js +61 -0
  37. package/es/components/eftposPay/aggregatePayment/utils/logs.d.ts +110 -0
  38. package/es/components/eftposPay/aggregatePayment/utils/logs.js +385 -0
  39. package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +132 -0
  40. package/es/components/eftposPay/aggregatePayment/utils/payment.js +1127 -0
  41. package/es/components/eftposPay/amount.d.ts +0 -1
  42. package/es/components/eftposPay/const.d.ts +6 -1
  43. package/es/components/eftposPay/const.js +2 -0
  44. package/es/components/eftposPay/hooks.d.ts +2 -1
  45. package/es/components/eftposPay/hooks.js +12 -0
  46. package/es/components/eftposPay/linkly/index.js +1 -0
  47. package/es/components/eftposPay/manufacturer.d.ts +1 -0
  48. package/es/components/eftposPay/manufacturer.js +4 -0
  49. package/es/components/eftposPay/mx51/Action.d.ts +6 -0
  50. package/es/components/eftposPay/mx51/Action.js +91 -0
  51. package/es/components/eftposPay/mx51/const.d.ts +5 -0
  52. package/es/components/eftposPay/mx51/const.js +69 -0
  53. package/es/components/eftposPay/mx51/index.d.ts +6 -0
  54. package/es/components/eftposPay/mx51/index.js +362 -0
  55. package/es/components/eftposPay/mx51/types.d.ts +136 -0
  56. package/es/components/eftposPay/mx51/types.js +29 -0
  57. package/es/components/eftposPay/mx51/utils.d.ts +10 -0
  58. package/es/components/eftposPay/mx51/utils.js +120 -0
  59. package/es/components/eftposPay/pay.js +7 -2
  60. package/es/components/eftposPay/store/index.d.ts +1 -1
  61. package/es/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
  62. package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
  63. package/es/components/eventBooking/components/Provider/Header/index.d.ts +1 -0
  64. package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
  65. package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
  66. package/es/components/eventBooking/components/Provider/SelectHolderModal.d.ts +1 -0
  67. package/es/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +1 -0
  68. package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
  69. package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +0 -1
  70. package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
  71. package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
  72. package/es/components/shoppingCart/hooks/useAddService.d.ts +0 -1
  73. package/es/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
  74. package/es/plus/saasRegister/components/VertifyEmail.d.ts +0 -1
  75. package/es/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +0 -1
  76. package/es/plus/skuOptionsSelection/components/TitleExtra/index.d.ts +0 -1
  77. package/es/plus/skuOptionsSelection/components/VariantCard/index.d.ts +0 -1
  78. package/es/plus/walletPassGallery/components/passList/index.d.ts +0 -1
  79. package/lib/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
  80. package/lib/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  81. package/lib/components/appointmentBooking/components/Footer/index.d.ts +0 -1
  82. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -1
  83. package/lib/components/booking/forms/footer.d.ts +0 -1
  84. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  85. package/lib/components/booking/hooks/useClearCart.d.ts +0 -1
  86. package/lib/components/booking/info/date/index.d.ts +1 -0
  87. package/lib/components/booking/info/dateRange/index.d.ts +0 -1
  88. package/lib/components/eftpos/const.d.ts +3 -1
  89. package/lib/components/eftpos/const.js +2 -0
  90. package/lib/components/eftpos/device.d.ts +3 -1
  91. package/lib/components/eftpos/device.js +3 -3
  92. package/lib/components/eftpos/index.d.ts +0 -1
  93. package/lib/components/eftpos/index.js +20 -5
  94. package/lib/components/eftpos/index.less +26 -1
  95. package/lib/components/eftpos/locales.d.ts +3 -0
  96. package/lib/components/eftpos/locales.js +3 -0
  97. package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +6 -0
  98. package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.js +152 -0
  99. package/lib/components/eftposPay/aggregatePayment/index.d.ts +3 -0
  100. package/lib/components/eftposPay/aggregatePayment/index.js +32 -0
  101. package/lib/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
  102. package/lib/components/eftposPay/aggregatePayment/mock.js +679 -0
  103. package/lib/components/eftposPay/aggregatePayment/service.d.ts +24 -0
  104. package/lib/components/eftposPay/aggregatePayment/service.js +81 -0
  105. package/lib/components/eftposPay/aggregatePayment/types.d.ts +96 -0
  106. package/lib/components/eftposPay/aggregatePayment/types.js +74 -0
  107. package/lib/components/eftposPay/aggregatePayment/utils/logs.d.ts +110 -0
  108. package/lib/components/eftposPay/aggregatePayment/utils/logs.js +302 -0
  109. package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +132 -0
  110. package/lib/components/eftposPay/aggregatePayment/utils/payment.js +746 -0
  111. package/lib/components/eftposPay/amount.d.ts +0 -1
  112. package/lib/components/eftposPay/const.d.ts +6 -1
  113. package/lib/components/eftposPay/const.js +2 -0
  114. package/lib/components/eftposPay/hooks.d.ts +2 -1
  115. package/lib/components/eftposPay/hooks.js +16 -0
  116. package/lib/components/eftposPay/linkly/index.js +1 -0
  117. package/lib/components/eftposPay/manufacturer.d.ts +1 -0
  118. package/lib/components/eftposPay/manufacturer.js +6 -0
  119. package/lib/components/eftposPay/mx51/Action.d.ts +6 -0
  120. package/lib/components/eftposPay/mx51/Action.js +127 -0
  121. package/lib/components/eftposPay/mx51/const.d.ts +5 -0
  122. package/lib/components/eftposPay/mx51/const.js +85 -0
  123. package/lib/components/eftposPay/mx51/index.d.ts +6 -0
  124. package/lib/components/eftposPay/mx51/index.js +330 -0
  125. package/lib/components/eftposPay/mx51/types.d.ts +136 -0
  126. package/lib/components/eftposPay/mx51/types.js +39 -0
  127. package/lib/components/eftposPay/mx51/utils.d.ts +10 -0
  128. package/lib/components/eftposPay/mx51/utils.js +114 -0
  129. package/lib/components/eftposPay/pay.js +4 -2
  130. package/lib/components/eftposPay/store/index.d.ts +1 -1
  131. package/lib/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
  132. package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
  133. package/lib/components/eventBooking/components/Provider/Header/index.d.ts +1 -0
  134. package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
  135. package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
  136. package/lib/components/eventBooking/components/Provider/SelectHolderModal.d.ts +1 -0
  137. package/lib/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +1 -0
  138. package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
  139. package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +0 -1
  140. package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
  141. package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
  142. package/lib/components/shoppingCart/hooks/useAddService.d.ts +0 -1
  143. package/lib/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
  144. package/lib/plus/saasRegister/components/VertifyEmail.d.ts +0 -1
  145. package/lib/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +0 -1
  146. package/lib/plus/skuOptionsSelection/components/TitleExtra/index.d.ts +0 -1
  147. package/lib/plus/skuOptionsSelection/components/VariantCard/index.d.ts +0 -1
  148. package/lib/plus/walletPassGallery/components/passList/index.d.ts +0 -1
  149. package/lowcode/eco-cup-list/meta.ts +63 -0
  150. package/lowcode/eco-customer-list/meta.ts +63 -0
  151. package/package.json +1 -1
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const Total: ({ className, isFooter }: any) => JSX.Element;
4
3
  export default Total;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const Cart: ({ open, onCancel, onNext }: any) => JSX.Element;
4
3
  export default Cart;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const Footer: ({ onNext, isOpen }: any) => JSX.Element;
4
3
  export default Footer;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const DepositModal: (props: any) => JSX.Element;
4
3
  export default DepositModal;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface FooterProps {
3
2
  state: any;
4
3
  reload: () => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SendModalValues } from './index';
3
2
  declare const useSendModal: (bookingId?: number) => {
4
3
  open: boolean;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const useClearCart: (state: any, dispatch: any) => false | JSX.Element;
3
2
  export default useClearCart;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import "./index.less";
2
3
  export declare const updateServiceDate: (services: any[], date: any, isTime: boolean) => any[];
3
4
  declare const DateCom: () => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  export declare const disabledDate: (current: any, position: any, currentDate: any) => any;
4
3
  declare const DateRange: ({ state, dispatch, key }: any) => JSX.Element;
@@ -2,7 +2,9 @@ export declare enum Eftpos {
2
2
  Payo = "payo",
3
3
  Tyro = "tyro",
4
4
  Windcave = "windcave",
5
- Stripe = "stripe"
5
+ Stripe = "stripe",
6
+ Linkly = "linkly",
7
+ MX51 = "mx51"
6
8
  }
7
9
  export declare enum DeviceEnum {
8
10
  /** 新增 */
@@ -19,6 +19,8 @@ export var Eftpos = /*#__PURE__*/function (Eftpos) {
19
19
  Eftpos["Tyro"] = "tyro";
20
20
  Eftpos["Windcave"] = "windcave";
21
21
  Eftpos["Stripe"] = "stripe";
22
+ Eftpos["Linkly"] = "linkly";
23
+ Eftpos["MX51"] = "mx51";
22
24
  return Eftpos;
23
25
  }({});
24
26
  export var DeviceEnum = /*#__PURE__*/function (DeviceEnum) {
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
- import { DeviceProp } from './const';
2
+ import { DeviceProp, Eftpos } from './const';
3
3
  interface DeviceProps {
4
4
  formItemList: any[];
5
5
  onSave: (device: DeviceProp) => void;
6
6
  children?: React.ReactNode;
7
+ type?: Eftpos;
8
+ status?: 'add' | 'edit' | 'repair';
7
9
  }
8
10
  declare const Device: (props: DeviceProps) => JSX.Element;
9
11
  export default Device;
@@ -1,14 +1,16 @@
1
1
  import React from 'react';
2
2
  import { Form, Button } from 'antd';
3
3
  import { locales } from '@pisell/utils';
4
- import { getDefaultValue } from "./const";
4
+ import { Eftpos, getDefaultValue } from "./const";
5
5
  import FormItem from "./form";
6
6
  var Device = function Device(props) {
7
7
  var onSave = props.onSave,
8
8
  children = props.children,
9
9
  formItemList = props.formItemList;
10
10
  var initialValues = getDefaultValue(formItemList);
11
- return /*#__PURE__*/React.createElement(Form, {
11
+ return /*#__PURE__*/React.createElement(React.Fragment, null, (props === null || props === void 0 ? void 0 : props.type) === Eftpos.MX51 && /*#__PURE__*/React.createElement("div", {
12
+ className: "pisell-lowcode__pos-device-pair-text"
13
+ }, "Pair your POS with an mx51 terminal using the pairing code shown on the terminal."), /*#__PURE__*/React.createElement(Form, {
12
14
  layout: "vertical",
13
15
  onFinish: onSave,
14
16
  initialValues: initialValues,
@@ -29,6 +31,6 @@ var Device = function Device(props) {
29
31
  style: {
30
32
  height: '48px'
31
33
  }
32
- }, locales.getText('page.eftpos.text.save'))));
34
+ }, (props === null || props === void 0 ? void 0 : props.status) === 'edit' ? locales.getText('page.eftpos.text.save') : locales.getText('page.eftpos.text.pair')))));
33
35
  };
34
36
  export default Device;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Eftpos, DeviceStatus } from './const';
3
2
  import './index.less';
4
3
  interface PosProps {
@@ -311,26 +311,47 @@ export default (function (props) {
311
311
  console.log('device = ', device);
312
312
  update = /*#__PURE__*/function () {
313
313
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
314
+ var _device$connection, _device$connection2;
314
315
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
315
316
  while (1) switch (_context3.prev = _context3.next) {
316
317
  case 0:
317
- _context3.next = 2;
318
+ _context3.prev = 0;
319
+ _context3.next = 3;
318
320
  return onEdit(_objectSpread(_objectSpread({}, device), {}, {
319
321
  type: type
320
- }), status || 'add').catch(function () {
321
- setLoading(false);
322
- });
323
- case 2:
322
+ }), status || 'add');
323
+ case 3:
324
+ if (type === Eftpos.MX51) {
325
+ messageApi.open({
326
+ type: 'success',
327
+ style: {
328
+ zIndex: (zIndex || 9999) + 1
329
+ },
330
+ content: /*#__PURE__*/React.createElement("div", {
331
+ className: "pisell-lowcode__pos_message-custom-content_mx51"
332
+ }, /*#__PURE__*/React.createElement("span", null, "Terminal paired successfully."), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, "Pairing Name: ", (device === null || device === void 0 || (_device$connection = device.connection) === null || _device$connection === void 0 ? void 0 : _device$connection.pairing_nickname) || '-'), /*#__PURE__*/React.createElement("span", null, "Pairing ID: ", (device === null || device === void 0 || (_device$connection2 = device.connection) === null || _device$connection2 === void 0 ? void 0 : _device$connection2.pairing_code) || '-')))
333
+ });
334
+ }
335
+ _context3.next = 9;
336
+ break;
337
+ case 6:
338
+ _context3.prev = 6;
339
+ _context3.t0 = _context3["catch"](0);
340
+ console.error('onSave error =>', _context3.t0);
341
+ case 9:
342
+ _context3.prev = 9;
324
343
  setLoading(false);
325
- _context3.next = 5;
344
+ return _context3.finish(9);
345
+ case 12:
346
+ _context3.next = 14;
326
347
  return tableRef.current.loadData();
327
- case 5:
348
+ case 14:
328
349
  setPage('list');
329
- case 6:
350
+ case 15:
330
351
  case "end":
331
352
  return _context3.stop();
332
353
  }
333
- }, _callee3);
354
+ }, _callee3, null, [[0, 6, 9, 12]]);
334
355
  }));
335
356
  return function update() {
336
357
  return _ref5.apply(this, arguments);
@@ -567,7 +588,7 @@ export default (function (props) {
567
588
  }), /*#__PURE__*/React.createElement(Drawer, {
568
589
  open: page === 'edit',
569
590
  onClose: onBack,
570
- title: locales.getText('page.eftpos.text.device.add')(status, name),
591
+ title: type === Eftpos.MX51 ? 'Simple Cloud Integration' : locales.getText('page.eftpos.text.device.add')(status, name),
571
592
  titleNoWrap: true,
572
593
  zIndex: zIndex || 9999,
573
594
  destroyOnClose: true,
@@ -579,7 +600,9 @@ export default (function (props) {
579
600
  }, /*#__PURE__*/React.createElement(Device, {
580
601
  formItemList: deviceItemList,
581
602
  onSave: onSave,
582
- key: "device".concat(type)
603
+ key: "device".concat(type),
604
+ type: type,
605
+ status: status
583
606
  }, pairStatus ? /*#__PURE__*/React.createElement(Form.Item, {
584
607
  label: "Status"
585
608
  }, /*#__PURE__*/React.createElement(Input, {
@@ -88,7 +88,6 @@
88
88
  display: flex;
89
89
  }
90
90
 
91
-
92
91
  .pisell-lowcode__pos_drawer {
93
92
  transform: translateZ(0);
94
93
  }
@@ -204,3 +203,29 @@
204
203
  display: flex;
205
204
  flex-direction: column;
206
205
  }
206
+ .pisell-lowcode__pos-device-pair-text {
207
+ padding: 0 24px 0 34px;
208
+ color: #101828;
209
+ font-size: 14px;
210
+ font-weight: 400;
211
+ }
212
+
213
+ .pisell-lowcode__pos_message
214
+ .pisell-lowcode__pos_message-notice-content
215
+ .pisell-lowcode__pos_message-success {
216
+ display: flex;
217
+ align-items: center;
218
+ }
219
+
220
+ .pisell-lowcode__pos_message-custom-content_mx51 {
221
+ display: flex;
222
+ flex-direction: column;
223
+ align-items: flex-start;
224
+ justify-content: center;
225
+
226
+ > span:last-child {
227
+ display: flex;
228
+ gap: 10px;
229
+ flex-wrap: wrap;
230
+ }
231
+ }
@@ -15,6 +15,7 @@ declare const _default: {
15
15
  'page.eftpos.text.edit': string;
16
16
  'page.eftpos.text.delete': string;
17
17
  'page.eftpos.text.save': string;
18
+ 'page.eftpos.text.pair': string;
18
19
  'page.eftpos.text.confim.delete': string;
19
20
  'page.eftpos.text.confirm_delete-message': (x: string) => string;
20
21
  'page.eftpos.text.confim.cancel': string;
@@ -47,6 +48,7 @@ declare const _default: {
47
48
  'page.eftpos.text.edit': string;
48
49
  'page.eftpos.text.delete': string;
49
50
  'page.eftpos.text.save': string;
51
+ 'page.eftpos.text.pair': string;
50
52
  'page.eftpos.text.confim.delete': string;
51
53
  'page.eftpos.text.confirm_delete-message': (x: string) => string;
52
54
  'page.eftpos.text.confim.cancel': string;
@@ -79,6 +81,7 @@ declare const _default: {
79
81
  'page.eftpos.text.edit': string;
80
82
  'page.eftpos.text.delete': string;
81
83
  'page.eftpos.text.save': string;
84
+ 'page.eftpos.text.pair': string;
82
85
  'page.eftpos.text.confim.delete': string;
83
86
  'page.eftpos.text.confirm_delete-message': (x: string) => string;
84
87
  'page.eftpos.text.confim.cancel': string;
@@ -21,6 +21,7 @@ export default {
21
21
  'page.eftpos.text.edit': 'Edit',
22
22
  'page.eftpos.text.delete': 'Delete',
23
23
  'page.eftpos.text.save': 'Save',
24
+ 'page.eftpos.text.pair': 'Pair',
24
25
  'page.eftpos.text.confim.delete': 'Confirm delete',
25
26
  'page.eftpos.text.confirm_delete-message': function pageEftposTextConfirm_deleteMessage(x) {
26
27
  return "Confirm delete ".concat(x, " Device");
@@ -61,6 +62,7 @@ export default {
61
62
  'page.eftpos.text.edit': '编辑',
62
63
  'page.eftpos.text.delete': '删除',
63
64
  'page.eftpos.text.save': '保存',
65
+ 'page.eftpos.text.pair': '配对',
64
66
  'page.eftpos.text.confim.delete': '确认删除',
65
67
  'page.eftpos.text.confirm_delete-message': function pageEftposTextConfirm_deleteMessage(x) {
66
68
  return "\u786E\u8BA4\u5220\u9664 ".concat(x, " \u8BBE\u5907\u5417\uFF1F");
@@ -101,6 +103,7 @@ export default {
101
103
  'page.eftpos.text.edit': '編輯',
102
104
  'page.eftpos.text.delete': '删除',
103
105
  'page.eftpos.text.save': '保存',
106
+ 'page.eftpos.text.pair': '配對',
104
107
  'page.eftpos.text.confim.delete': '確認刪除',
105
108
  'page.eftpos.text.confirm_delete-message': function pageEftposTextConfirm_deleteMessage(x) {
106
109
  return "\u78BA\u8A8D\u522A\u9664 ".concat(x, " \u8A2D\u5099\u55CE\uFF1F");
@@ -0,0 +1,6 @@
1
+ import { PaymentMethodOptions } from '../types';
2
+ export declare const usePayment: (options: PaymentMethodOptions) => {
3
+ run: () => void;
4
+ query: () => void;
5
+ action: (data: Record<string, any>) => void;
6
+ };
@@ -0,0 +1,125 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ 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; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ import { useEffect, useRef } from 'react';
8
+ import PaymentMethod from "../utils/payment";
9
+ import { ModeEnum } from "../../const";
10
+ import { useStoreRef } from "../../hooks";
11
+ import { getUuid } from "../../helper";
12
+ import { useDispatch, updateState } from "../../store";
13
+ import { useContextData } from "../../store";
14
+ export var usePayment = function usePayment(options) {
15
+ var _useContextData = useContextData(),
16
+ custom = _useContextData.custom;
17
+ var _useStoreRef = useStoreRef(),
18
+ modeRef = _useStoreRef.modeRef,
19
+ payRef = _useStoreRef.payRef,
20
+ orderIdRef = _useStoreRef.orderIdRef,
21
+ eftposRef = _useStoreRef.eftposRef,
22
+ deviceRef = _useStoreRef.deviceRef,
23
+ dataRef = _useStoreRef.dataRef,
24
+ amountRef = _useStoreRef.amountRef;
25
+ var paymentMethodRef = useRef(null);
26
+ var dispatch = useDispatch();
27
+ var uniquePaymentNumberRef = useRef(null);
28
+ var isPay = modeRef.current === ModeEnum.Pay || modeRef.current === ModeEnum.FullPay;
29
+ useEffect(function () {
30
+ if (!paymentMethodRef.current) {
31
+ var _deviceRef$current;
32
+ // 如果不存在交易号需要先创建一个交易号
33
+ if (!options.paymentNum) {
34
+ var paymentNum = getUuid();
35
+ dispatch(updateState({
36
+ number: paymentNum
37
+ }));
38
+ options.paymentNum = paymentNum;
39
+ uniquePaymentNumberRef.current = paymentNum;
40
+ } else {
41
+ uniquePaymentNumberRef.current = options.paymentNum;
42
+ }
43
+ options.orderId = orderIdRef.current;
44
+ options.deviceId = (_deviceRef$current = deviceRef.current) === null || _deviceRef$current === void 0 ? void 0 : _deviceRef$current.id;
45
+ paymentMethodRef.current = new PaymentMethod(options);
46
+ }
47
+ return function () {
48
+ var _paymentMethodRef$cur, _paymentMethodRef$cur2;
49
+ // 卸载组件时,如果paymentMethodRef存在需要先执行销毁,再清空
50
+ (_paymentMethodRef$cur = paymentMethodRef.current) === null || _paymentMethodRef$cur === void 0 || (_paymentMethodRef$cur2 = _paymentMethodRef$cur.destroy) === null || _paymentMethodRef$cur2 === void 0 || _paymentMethodRef$cur2.call(_paymentMethodRef$cur);
51
+ paymentMethodRef.current = null;
52
+ };
53
+ }, []);
54
+ var run = function run() {
55
+ var _payRef$current, _deviceRef$current2;
56
+ var params = {
57
+ order_id: orderIdRef.current,
58
+ unique_payment_number: uniquePaymentNumberRef.current,
59
+ payment_code: options.paymentCode,
60
+ amount: isPay ? (_payRef$current = payRef.current) === null || _payRef$current === void 0 ? void 0 : _payRef$current.total : amountRef.current,
61
+ operator_id: custom === null || custom === void 0 ? void 0 : custom.operator_id,
62
+ operator_type: custom === null || custom === void 0 ? void 0 : custom.operator_type,
63
+ platform: custom === null || custom === void 0 ? void 0 : custom.platform,
64
+ eftpos: {
65
+ card_reader_type: eftposRef.current,
66
+ card_reader_id: (_deviceRef$current2 = deviceRef.current) === null || _deviceRef$current2 === void 0 ? void 0 : _deviceRef$current2.id,
67
+ pay_param_base64: encodeURIComponent(btoa(encodeURIComponent(JSON.stringify(_objectSpread(_objectSpread({}, dataRef.current), {}, {
68
+ number: uniquePaymentNumberRef.current
69
+ })))))
70
+ }
71
+ };
72
+ if (isPay) {
73
+ var _payRef$current2, _payRef$current3, _payRef$current4, _paymentMethodRef$cur3;
74
+ params.payment = {
75
+ original_amount: (_payRef$current2 = payRef.current) === null || _payRef$current2 === void 0 ? void 0 : _payRef$current2.amount,
76
+ order_payment_type: 'normal',
77
+ // TODO: 需要使用方提供
78
+ custom_payment_id: custom === null || custom === void 0 ? void 0 : custom.custom_payment_id,
79
+ custom_payment_code: custom === null || custom === void 0 ? void 0 : custom.custom_payment_code,
80
+ custom_payment_name: custom === null || custom === void 0 ? void 0 : custom.custom_payment_name,
81
+ custom_payment_type: custom === null || custom === void 0 ? void 0 : custom.custom_payment_type,
82
+ service_charge: {
83
+ amount: (_payRef$current3 = payRef.current) === null || _payRef$current3 === void 0 ? void 0 : _payRef$current3.surMoney,
84
+ percentage: (_payRef$current4 = payRef.current) === null || _payRef$current4 === void 0 ? void 0 : _payRef$current4.surPercentRate
85
+ },
86
+ metadata: {
87
+ unique_payment_number: uniquePaymentNumberRef.current
88
+ }
89
+ };
90
+ (_paymentMethodRef$cur3 = paymentMethodRef.current) === null || _paymentMethodRef$cur3 === void 0 || _paymentMethodRef$cur3.pay(params);
91
+ } else {
92
+ var _paymentMethodRef$cur4;
93
+ (_paymentMethodRef$cur4 = paymentMethodRef.current) === null || _paymentMethodRef$cur4 === void 0 || _paymentMethodRef$cur4.refund(params);
94
+ }
95
+ };
96
+ var query = function query() {
97
+ if (isPay) {
98
+ var _paymentMethodRef$cur5;
99
+ (_paymentMethodRef$cur5 = paymentMethodRef.current) === null || _paymentMethodRef$cur5 === void 0 || _paymentMethodRef$cur5.payQuery();
100
+ } else {
101
+ var _paymentMethodRef$cur6;
102
+ (_paymentMethodRef$cur6 = paymentMethodRef.current) === null || _paymentMethodRef$cur6 === void 0 || _paymentMethodRef$cur6.refundQuery();
103
+ }
104
+ };
105
+ var action = function action(data) {
106
+ var params = {
107
+ order_id: orderIdRef.current,
108
+ unique_payment_number: uniquePaymentNumberRef.current,
109
+ payment_code: options.paymentCode,
110
+ data: data
111
+ };
112
+ if (isPay) {
113
+ var _paymentMethodRef$cur7;
114
+ (_paymentMethodRef$cur7 = paymentMethodRef.current) === null || _paymentMethodRef$cur7 === void 0 || _paymentMethodRef$cur7.payAction(params);
115
+ } else {
116
+ var _paymentMethodRef$cur8;
117
+ (_paymentMethodRef$cur8 = paymentMethodRef.current) === null || _paymentMethodRef$cur8 === void 0 || _paymentMethodRef$cur8.refundAction(params);
118
+ }
119
+ };
120
+ return {
121
+ run: run,
122
+ query: query,
123
+ action: action
124
+ };
125
+ };
@@ -0,0 +1,3 @@
1
+ import { EActionStatus } from './types';
2
+ import { usePayment } from './hooks/usePayment';
3
+ export { usePayment, EActionStatus };
@@ -0,0 +1,3 @@
1
+ import { EActionStatus } from "./types";
2
+ import { usePayment } from "./hooks/usePayment";
3
+ export { usePayment, EActionStatus };