@pisell/private-materials 3.3.97 → 3.3.99

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 (193) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +11 -11
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +11 -11
  11. package/es/components/Sales/Cart/index.js +1 -5
  12. package/es/components/Sales/Cart/utils.d.ts +0 -40
  13. package/es/components/Sales/Cart/utils.js +0 -167
  14. package/es/components/Sales/Checkout/index.d.ts +0 -4
  15. package/es/components/Sales/Checkout/index.js +8 -52
  16. package/es/components/Sales/Checkout/serve.d.ts +0 -13
  17. package/es/components/Sales/Checkout/serve.js +2 -16
  18. package/es/components/Sales/Checkout/utils.js +1 -7
  19. package/es/components/Sales/Summary/index.d.ts +0 -10
  20. package/es/components/Sales/Summary/index.js +2 -17
  21. package/es/components/Sales/Summary/serve.d.ts +0 -1
  22. package/es/components/Sales/Summary/serve.js +0 -6
  23. package/es/components/Sales/Summary/utils.d.ts +0 -15
  24. package/es/components/Sales/Summary/utils.js +1 -43
  25. package/es/components/appointmentBooking/components/Cart/Item/index.less +3 -3
  26. package/es/components/appointmentBooking/components/Content/index.js +1 -15
  27. package/es/components/appointmentBooking/components/Content/index.less +1 -1
  28. package/es/components/appointmentBooking/components/Deposit/index.d.ts +0 -6
  29. package/es/components/appointmentBooking/components/Deposit/index.js +7 -27
  30. package/es/components/appointmentBooking/components/Footer/index.d.ts +1 -0
  31. package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
  32. package/es/components/appointmentBooking/components/Services/index.js +27 -23
  33. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.js +20 -25
  34. package/es/components/appointmentBooking/deposit/index.js +2 -4
  35. package/es/components/appointmentBooking/index.js +0 -14
  36. package/es/components/appointmentBooking/index.less +1 -1
  37. package/es/components/booking/components/voucher/index.js +2 -2
  38. package/es/components/booking/info/dateRange/index.d.ts +1 -0
  39. package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  40. package/es/components/booking/info/index.d.ts +1 -0
  41. package/es/components/booking/info/service/Lists.d.ts +0 -1
  42. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  43. package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  44. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  45. package/es/components/booking/materiels/startTime/index.d.ts +0 -1
  46. package/es/components/booking/utils.d.ts +2 -2
  47. package/es/components/eftposPay/amount.d.ts +1 -1
  48. package/es/components/eftposPay/app.d.ts +0 -1
  49. package/es/components/eftposPay/const.d.ts +1 -4
  50. package/es/components/eftposPay/const.js +1 -3
  51. package/es/components/eftposPay/device.d.ts +1 -1
  52. package/es/components/eftposPay/hooks.d.ts +2 -2
  53. package/es/components/eftposPay/hooks.js +1 -3
  54. package/es/components/eftposPay/index.js +1 -1
  55. package/es/components/eftposPay/manufacturer.d.ts +0 -1
  56. package/es/components/eftposPay/manufacturer.js +0 -4
  57. package/es/components/eftposPay/pay.d.ts +1 -1
  58. package/es/components/eftposPay/pay.js +2 -6
  59. package/es/components/eftposPay/payo/config.js +1 -1
  60. package/es/components/eftposPay/store/index.d.ts +4 -4
  61. package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
  62. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +17 -29
  63. package/es/components/eventBooking/components/Provider/Cart/Item/Total.js +6 -10
  64. package/es/components/eventBooking/components/Provider/Cart/Item/index.js +2 -4
  65. package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
  66. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  67. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
  68. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
  69. package/es/components/eventBooking/components/bookingDetailModal/index.js +1 -3
  70. package/es/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
  71. package/es/components/eventBooking/locales.d.ts +0 -24
  72. package/es/components/eventBooking/locales.js +3 -27
  73. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
  74. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
  75. package/es/components/pay/toC/PaymentMethods/index.js +4 -5
  76. package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
  77. package/es/components/shoppingCart/components/Cart/Product.d.ts +1 -0
  78. package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -1
  79. package/es/components/ticketBooking/components/ticketBooking/index.js +1 -120
  80. package/es/components/ticketBooking/locales.d.ts +146 -164
  81. package/es/components/ticketBooking/locales.js +147 -195
  82. package/es/components/workSpaceList/components/Modal/index.d.ts +1 -0
  83. package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
  84. package/lib/components/Sales/Cart/index.js +0 -1
  85. package/lib/components/Sales/Cart/utils.d.ts +0 -40
  86. package/lib/components/Sales/Cart/utils.js +0 -117
  87. package/lib/components/Sales/Checkout/index.d.ts +0 -4
  88. package/lib/components/Sales/Checkout/index.js +7 -39
  89. package/lib/components/Sales/Checkout/serve.d.ts +0 -13
  90. package/lib/components/Sales/Checkout/serve.js +2 -7
  91. package/lib/components/Sales/Checkout/utils.js +0 -2
  92. package/lib/components/Sales/Summary/index.d.ts +0 -10
  93. package/lib/components/Sales/Summary/index.js +1 -7
  94. package/lib/components/Sales/Summary/serve.d.ts +0 -1
  95. package/lib/components/Sales/Summary/serve.js +0 -32
  96. package/lib/components/Sales/Summary/utils.d.ts +0 -15
  97. package/lib/components/Sales/Summary/utils.js +1 -30
  98. package/lib/components/appointmentBooking/components/Cart/Item/index.less +3 -3
  99. package/lib/components/appointmentBooking/components/Content/index.js +1 -6
  100. package/lib/components/appointmentBooking/components/Content/index.less +1 -1
  101. package/lib/components/appointmentBooking/components/Deposit/index.d.ts +0 -6
  102. package/lib/components/appointmentBooking/components/Deposit/index.js +4 -36
  103. package/lib/components/appointmentBooking/components/Footer/index.d.ts +1 -0
  104. package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
  105. package/lib/components/appointmentBooking/components/Services/index.js +11 -6
  106. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.js +4 -8
  107. package/lib/components/appointmentBooking/deposit/index.js +2 -4
  108. package/lib/components/appointmentBooking/index.js +0 -11
  109. package/lib/components/appointmentBooking/index.less +1 -1
  110. package/lib/components/booking/components/voucher/index.js +2 -2
  111. package/lib/components/booking/info/dateRange/index.d.ts +1 -0
  112. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  113. package/lib/components/booking/info/index.d.ts +1 -0
  114. package/lib/components/booking/info/service/Lists.d.ts +0 -1
  115. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  116. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  117. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  118. package/lib/components/booking/materiels/startTime/index.d.ts +0 -1
  119. package/lib/components/booking/utils.d.ts +2 -2
  120. package/lib/components/eftposPay/amount.d.ts +1 -1
  121. package/lib/components/eftposPay/app.d.ts +0 -1
  122. package/lib/components/eftposPay/const.d.ts +1 -4
  123. package/lib/components/eftposPay/const.js +0 -2
  124. package/lib/components/eftposPay/device.d.ts +1 -1
  125. package/lib/components/eftposPay/hooks.d.ts +2 -2
  126. package/lib/components/eftposPay/hooks.js +4 -11
  127. package/lib/components/eftposPay/index.js +1 -1
  128. package/lib/components/eftposPay/manufacturer.d.ts +0 -1
  129. package/lib/components/eftposPay/manufacturer.js +0 -6
  130. package/lib/components/eftposPay/pay.d.ts +1 -1
  131. package/lib/components/eftposPay/pay.js +2 -13
  132. package/lib/components/eftposPay/payo/config.js +1 -1
  133. package/lib/components/eftposPay/store/index.d.ts +4 -4
  134. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
  135. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +3 -16
  136. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.js +5 -8
  137. package/lib/components/eventBooking/components/Provider/Cart/Item/index.js +2 -4
  138. package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
  139. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  140. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
  141. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
  142. package/lib/components/eventBooking/components/bookingDetailModal/index.js +1 -1
  143. package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
  144. package/lib/components/eventBooking/locales.d.ts +0 -24
  145. package/lib/components/eventBooking/locales.js +3 -27
  146. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
  147. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
  148. package/lib/components/pay/toC/PaymentMethods/index.js +9 -10
  149. package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
  150. package/lib/components/shoppingCart/components/Cart/Product.d.ts +1 -0
  151. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +1 -1
  152. package/lib/components/ticketBooking/components/ticketBooking/index.js +1 -120
  153. package/lib/components/ticketBooking/locales.d.ts +146 -164
  154. package/lib/components/ticketBooking/locales.js +4 -22
  155. package/lib/components/workSpaceList/components/Modal/index.d.ts +1 -0
  156. package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
  157. package/package.json +4 -4
  158. package/es/components/eftposPay/linkly/const.d.ts +0 -23
  159. package/es/components/eftposPay/linkly/const.js +0 -82
  160. package/es/components/eftposPay/linkly/hooks/index.d.ts +0 -2
  161. package/es/components/eftposPay/linkly/hooks/index.js +0 -2
  162. package/es/components/eftposPay/linkly/hooks/normal.d.ts +0 -30
  163. package/es/components/eftposPay/linkly/hooks/normal.js +0 -321
  164. package/es/components/eftposPay/linkly/hooks/useTimeQuery.d.ts +0 -4
  165. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +0 -273
  166. package/es/components/eftposPay/linkly/index.d.ts +0 -2
  167. package/es/components/eftposPay/linkly/index.js +0 -197
  168. package/es/components/eftposPay/linkly/service.d.ts +0 -32
  169. package/es/components/eftposPay/linkly/service.js +0 -81
  170. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +0 -3
  171. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.js +0 -17
  172. package/es/components/ticketBooking/utils/formatProductMessage.d.ts +0 -2
  173. package/es/components/ticketBooking/utils/formatProductMessage.js +0 -62
  174. package/es/components/ticketBooking/utils/formatTime.d.ts +0 -31
  175. package/es/components/ticketBooking/utils/formatTime.js +0 -144
  176. package/lib/components/eftposPay/linkly/const.d.ts +0 -23
  177. package/lib/components/eftposPay/linkly/const.js +0 -102
  178. package/lib/components/eftposPay/linkly/hooks/index.d.ts +0 -2
  179. package/lib/components/eftposPay/linkly/hooks/index.js +0 -25
  180. package/lib/components/eftposPay/linkly/hooks/normal.d.ts +0 -30
  181. package/lib/components/eftposPay/linkly/hooks/normal.js +0 -242
  182. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.d.ts +0 -4
  183. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +0 -222
  184. package/lib/components/eftposPay/linkly/index.d.ts +0 -2
  185. package/lib/components/eftposPay/linkly/index.js +0 -208
  186. package/lib/components/eftposPay/linkly/service.d.ts +0 -32
  187. package/lib/components/eftposPay/linkly/service.js +0 -55
  188. package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +0 -3
  189. package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.js +0 -55
  190. package/lib/components/ticketBooking/utils/formatProductMessage.d.ts +0 -2
  191. package/lib/components/ticketBooking/utils/formatProductMessage.js +0 -84
  192. package/lib/components/ticketBooking/utils/formatTime.d.ts +0 -31
  193. package/lib/components/ticketBooking/utils/formatTime.js +0 -139
@@ -1,82 +0,0 @@
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
- var _excluded = ["order_id", "name", "symbol", "amount", "mode", "number", "pay", "device", "net", "client"];
3
- 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; }
4
- 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; }
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; }
6
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
- 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); }
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
- 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
- import { locales } from '@pisell/utils';
11
- import { ClientEnum, EftposEnum, ModeEnum, PayRouteEnum, StatusEnum } from "../const";
12
- export var getStep = function getStep() {
13
- var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ModeEnum.Pay;
14
- return [{
15
- key: Date.now(),
16
- title: locales.getText('page.eftpos-pay.text.loading')(mode),
17
- // 'Payment in process...',
18
- text: locales.getText('page.eftpos-pay.text.waiting.processing'),
19
- // 'Waiting for the processing...',
20
- warn: '',
21
- tip: locales.getText('page.eftpos-pay.text.processing'),
22
- // 'processing...',
23
- status: StatusEnum.Loading
24
- }];
25
- };
26
- export default (function (params) {
27
- var _ref = params || {
28
- mode: ModeEnum.Pay
29
- },
30
- order_id = _ref.order_id,
31
- name = _ref.name,
32
- symbol = _ref.symbol,
33
- amount = _ref.amount,
34
- mode = _ref.mode,
35
- number = _ref.number,
36
- pay = _ref.pay,
37
- device = _ref.device,
38
- net = _ref.net,
39
- client = _ref.client,
40
- other = _objectWithoutProperties(_ref, _excluded);
41
- console.log('params =>>>>>> ', params);
42
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
43
- order_id: order_id,
44
- name: name,
45
- symbol: symbol,
46
- amount: amount,
47
- mode: mode,
48
- eftpos: EftposEnum.Linkly,
49
- key: Date.now(),
50
- step: 0,
51
- type: PayRouteEnum.Step,
52
- title: locales.getText('page.eftpos-pay.text.loading')(mode),
53
- component: '',
54
- status: StatusEnum.Loading,
55
- steps: getStep(mode),
56
- render: true,
57
- client: client !== 'undefined' ? client : ClientEnum.Merchant,
58
- warn: '',
59
- custom: other || {}
60
- }, typeof net !== 'undefined' ? {
61
- net: net
62
- } : {}), typeof number !== 'undefined' ? {
63
- number: number
64
- } : {}), typeof pay !== 'undefined' ? {
65
- pay: pay
66
- } : {}), typeof device !== 'undefined' ? {
67
- device: device
68
- } : {});
69
- });
70
- export var EVisibleButtonType = /*#__PURE__*/function (EVisibleButtonType) {
71
- EVisibleButtonType["CancelButton"] = "CancelButton";
72
- EVisibleButtonType["WaitButton"] = "WaitButton";
73
- return EVisibleButtonType;
74
- }({});
75
- export var LinklyActionStatus = /*#__PURE__*/function (LinklyActionStatus) {
76
- LinklyActionStatus["Empty"] = "Empty";
77
- LinklyActionStatus["Cancel"] = "Cancel";
78
- LinklyActionStatus["CancelWaiting"] = "CancelWaiting";
79
- LinklyActionStatus["Signature"] = "Signature";
80
- LinklyActionStatus["SignatureWaiting"] = "SignatureWaiting";
81
- return LinklyActionStatus;
82
- }({});
@@ -1,2 +0,0 @@
1
- export * from './normal';
2
- export * from './useTimeQuery';
@@ -1,2 +0,0 @@
1
- export * from "./normal";
2
- export * from "./useTimeQuery";
@@ -1,30 +0,0 @@
1
- /**
2
- * 支付或退款
3
- * @param failAction 失败回调
4
- */
5
- export declare const useLinklyPayOrRefund: (handleCheck: () => boolean) => {
6
- action: {
7
- pay: import("ahooks/lib/useRequest/src/types").Result<any, [data: any]>;
8
- };
9
- payOrRefund: (resultQuery: any, handleLinklySuccess: any) => void;
10
- };
11
- /**
12
- * @title: 取消支付或退款
13
- * @description: 取消支付或退款调用接口后不管成功还是失败都需要调用支付查询接口
14
- */
15
- export declare const useLinklyCancel: (handleCheck: () => boolean) => {
16
- action: {
17
- cancel: import("ahooks/lib/useRequest/src/types").Result<any, [param: any]>;
18
- };
19
- linklyCancel: (resultQuery: any) => void;
20
- };
21
- /**
22
- * @title: 支付或退款签名
23
- * @description: 支付或退款签名调用接口后不管成功还是失败都需要调用支付查询接口
24
- */
25
- export declare const useLinklySignature: (handleCheck: () => boolean) => {
26
- action: {
27
- signature: import("ahooks/lib/useRequest/src/types").Result<any, [param: any]>;
28
- };
29
- linklySignature: (status: number, resultQuery: any) => void;
30
- };
@@ -1,321 +0,0 @@
1
- import { useRequest } from 'ahooks';
2
- import { useEffect, useRef } from 'react';
3
- import { locales, sendWarningLog } from '@pisell/utils';
4
- import { linklyPayCancelApi, linklyPayApi, linklyRefundCancelApi, linklyRefundApi, linklyPaySignatureApi, linklyRefundSignatureApi } from "../service";
5
- import { useFail, useStoreRef } from "../../hooks";
6
- import { ModeEnum, PayStatus, StatusEnum } from "../../const";
7
- import { useDispatch, updateState, updateCustom, updateStatus } from "../../store";
8
- import { LinklyActionStatus } from "../const";
9
-
10
- /**
11
- * 支付或退款
12
- * @param failAction 失败回调
13
- */
14
- export var useLinklyPayOrRefund = function useLinklyPayOrRefund(handleCheck) {
15
- var dispatch = useDispatch();
16
- var _useStoreRef = useStoreRef(),
17
- numRef = _useStoreRef.numRef,
18
- modeRef = _useStoreRef.modeRef,
19
- orderIdRef = _useStoreRef.orderIdRef,
20
- deviceRef = _useStoreRef.deviceRef,
21
- payRef = _useStoreRef.payRef,
22
- amountRef = _useStoreRef.amountRef;
23
- var fail = useFail(0);
24
- var failRef = useRef(fail);
25
- var resultQueryRef = useRef(null);
26
- var handleLinklySuccessRef = useRef(null);
27
- useEffect(function () {
28
- failRef.current = fail;
29
- }, [fail]);
30
- var isPay = modeRef.current === ModeEnum.Pay || modeRef.current === ModeEnum.FullPay;
31
- var _pay = useRequest(isPay ? linklyPayApi : linklyRefundApi, {
32
- manual: true,
33
- onSuccess: function onSuccess(res) {
34
- _onSuccess(res);
35
- },
36
- onError: function onError(error) {
37
- _onError(error);
38
-
39
- // TODO: mock数据
40
- // console.log('mock>>>>>>');
41
- // const res = {
42
- // status: true,
43
- // code: 200,
44
- // message: '',
45
- // data: {
46
- // pinpad_id: 3,
47
- // is_auto_print: 0,
48
- // session_id: '923d4abe-6521-43c8-915b-decde8b406bd',
49
- // status: 0,
50
- // response_code: '00',
51
- // response_text: 'APPROVED',
52
- // signature_flag: 0,
53
- // },
54
- // };
55
- // onSuccess(res, isPay ? 'pay' : 'refund');
56
- }
57
- });
58
- var _onSuccess = function _onSuccess(res) {
59
- var _res$data;
60
- console.log("linkly".concat(isPay ? 'Pay' : 'Refund', "Success---->>>>>>>"), res);
61
- if (!handleCheck()) {
62
- return;
63
- }
64
- sendWarningLog({
65
- title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u63A5\u53E3\u6210\u529F"),
66
- content: [{
67
- key: 'response',
68
- value: JSON.stringify(res)
69
- }]
70
- });
71
-
72
- // status 交易状态 0:未知,继续查询 1:成功 -1:失败 -2:交易错误
73
- // signature_flag 是否弹框确认签名 0:不用签名 1:等待签名确认 2:签名取消 3:签名确认
74
- var status = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.status;
75
-
76
- // 继续查询交易状态
77
- if (status === 0) {
78
- var _res$data2;
79
- // 交易流水号
80
- numRef.current = res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.session_id;
81
- dispatch(updateState({
82
- number: numRef.current
83
- }));
84
- // 需要展示取消按钮
85
- dispatch(updateCustom({
86
- actionStatus: LinklyActionStatus.Cancel
87
- }));
88
- // 调用支付查询接口
89
- setTimeout(function () {
90
- var _resultQueryRef$curre;
91
- (_resultQueryRef$curre = resultQueryRef.current) === null || _resultQueryRef$curre === void 0 || _resultQueryRef$curre.call(resultQueryRef);
92
- });
93
- return;
94
- }
95
-
96
- // 无需展示取消按钮
97
- dispatch(updateCustom({
98
- actionStatus: LinklyActionStatus.Empty
99
- }));
100
-
101
- // 交易成功
102
- if (status === 1) {
103
- var _handleLinklySuccessR;
104
- (_handleLinklySuccessR = handleLinklySuccessRef.current) === null || _handleLinklySuccessR === void 0 || _handleLinklySuccessR.call(handleLinklySuccessRef, res);
105
- return;
106
- }
107
-
108
- // 交易失败
109
- if (status < 0) {
110
- var _failRef$current;
111
- // 需要特殊处理,将code码转换为支付失败code码
112
- res.code = PayStatus.Unknown;
113
- (_failRef$current = failRef.current) === null || _failRef$current === void 0 || _failRef$current.call(failRef, res, false);
114
- }
115
- };
116
- var _onError = function _onError(error) {
117
- var _failRef$current2;
118
- console.log("linkly".concat(isPay ? 'Pay' : 'Refund', "Error---->>>>>>>"), error);
119
- // 无网 或 已卸载 则不进行处理
120
- if (!handleCheck()) {
121
- return;
122
- }
123
- sendWarningLog({
124
- title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u63A5\u53E3\u5931\u8D25"),
125
- content: [{
126
- key: 'error',
127
- value: JSON.stringify(error)
128
- }]
129
- });
130
- (_failRef$current2 = failRef.current) === null || _failRef$current2 === void 0 || _failRef$current2.call(failRef, error, false);
131
- };
132
- var payOrRefund = function payOrRefund(resultQuery, handleLinklySuccess) {
133
- var _deviceRef$current, _payRef$current;
134
- handleLinklySuccessRef.current = handleLinklySuccess;
135
- resultQueryRef.current = resultQuery;
136
- var param = {
137
- // 订单id
138
- order_id: orderIdRef.current,
139
- // 设备id
140
- pinpad_id: deviceRef === null || deviceRef === void 0 || (_deviceRef$current = deviceRef.current) === null || _deviceRef$current === void 0 || (_deviceRef$current = _deviceRef$current.metadata) === null || _deviceRef$current === void 0 ? void 0 : _deviceRef$current.linkly_pinpad_id,
141
- // 交易金额, 包含选择的订单金额+手续费,订单金额+手续费=交易金额
142
- amount: isPay ? (_payRef$current = payRef.current) === null || _payRef$current === void 0 ? void 0 : _payRef$current.total : amountRef.current
143
- };
144
- sendWarningLog({
145
- title: "Linkly-".concat(isPay ? 'Pay' : 'Refund'),
146
- content: [{
147
- key: 'params',
148
- value: JSON.stringify(param)
149
- }]
150
- });
151
- _pay.run(param);
152
- };
153
- return {
154
- action: {
155
- pay: _pay
156
- },
157
- payOrRefund: payOrRefund
158
- };
159
- };
160
-
161
- /**
162
- * @title: 取消支付或退款
163
- * @description: 取消支付或退款调用接口后不管成功还是失败都需要调用支付查询接口
164
- */
165
- export var useLinklyCancel = function useLinklyCancel(handleCheck) {
166
- var dispatch = useDispatch();
167
- var _useStoreRef2 = useStoreRef(),
168
- numRef = _useStoreRef2.numRef,
169
- modeRef = _useStoreRef2.modeRef,
170
- deviceRef = _useStoreRef2.deviceRef;
171
- var resultQueryRef = useRef(null);
172
- var isPay = modeRef.current === ModeEnum.Pay || modeRef.current === ModeEnum.FullPay;
173
- var cancelAction = function cancelAction(res, type) {
174
- var _resultQueryRef$curre2;
175
- // 需要将按钮状态释放
176
- dispatch(updateCustom({
177
- buttonDisabled: false
178
- }));
179
- if (!handleCheck()) {
180
- return;
181
- }
182
- if (type === 'success') {
183
- sendWarningLog({
184
- title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u53D6\u6D88\u6210\u529F"),
185
- content: [{
186
- key: 'response',
187
- value: JSON.stringify(res)
188
- }]
189
- });
190
- } else {
191
- sendWarningLog({
192
- title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u53D6\u6D88\u5931\u8D25"),
193
- content: [{
194
- key: 'error',
195
- value: JSON.stringify(res)
196
- }]
197
- });
198
- }
199
- (_resultQueryRef$curre2 = resultQueryRef.current) === null || _resultQueryRef$curre2 === void 0 || _resultQueryRef$curre2.call(resultQueryRef);
200
- };
201
- var _cancel = useRequest(isPay ? linklyPayCancelApi : linklyRefundCancelApi, {
202
- manual: true,
203
- onSuccess: function onSuccess(res) {
204
- return cancelAction(res, 'success');
205
- },
206
- onError: function onError(error) {
207
- return cancelAction(error, 'error');
208
- }
209
- });
210
- var linklyCancel = function linklyCancel(resultQuery) {
211
- var _deviceRef$current2;
212
- resultQueryRef.current = resultQuery;
213
- // 需要将按钮状态锁定,防止重复点击
214
- dispatch(updateCustom({
215
- buttonDisabled: true
216
- }));
217
- var param = {
218
- // 设备id
219
- pinpad_id: deviceRef === null || deviceRef === void 0 || (_deviceRef$current2 = deviceRef.current) === null || _deviceRef$current2 === void 0 || (_deviceRef$current2 = _deviceRef$current2.metadata) === null || _deviceRef$current2 === void 0 ? void 0 : _deviceRef$current2.linkly_pinpad_id,
220
- // 交易流水号
221
- session_id: numRef.current
222
- };
223
- sendWarningLog({
224
- title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u53D6\u6D88"),
225
- content: [{
226
- key: 'params',
227
- value: JSON.stringify(param)
228
- }]
229
- });
230
- _cancel.run(param);
231
- dispatch(updateCustom({
232
- actionStatus: LinklyActionStatus.CancelWaiting
233
- }));
234
- };
235
- return {
236
- action: {
237
- cancel: _cancel
238
- },
239
- linklyCancel: linklyCancel
240
- };
241
- };
242
-
243
- /**
244
- * @title: 支付或退款签名
245
- * @description: 支付或退款签名调用接口后不管成功还是失败都需要调用支付查询接口
246
- */
247
- export var useLinklySignature = function useLinklySignature(handleCheck) {
248
- var dispatch = useDispatch();
249
- var _useStoreRef3 = useStoreRef(),
250
- numRef = _useStoreRef3.numRef,
251
- modeRef = _useStoreRef3.modeRef,
252
- deviceRef = _useStoreRef3.deviceRef;
253
- var resultQueryRef = useRef(null);
254
- var isPay = modeRef.current === ModeEnum.Pay || modeRef.current === ModeEnum.FullPay;
255
- var signatureAction = function signatureAction(res, type) {
256
- var _resultQueryRef$curre3;
257
- console.log('signatureAction---->>>>>>>', res);
258
- if (!handleCheck()) {
259
- return;
260
- }
261
- if (type === 'success') {
262
- sendWarningLog({
263
- title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u7B7E\u540D\u6210\u529F"),
264
- content: [{
265
- key: 'response',
266
- value: JSON.stringify(res)
267
- }]
268
- });
269
- } else {
270
- sendWarningLog({
271
- title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u7B7E\u540D\u5931\u8D25"),
272
- content: [{
273
- key: 'error',
274
- value: JSON.stringify(res)
275
- }]
276
- });
277
- }
278
- (_resultQueryRef$curre3 = resultQueryRef.current) === null || _resultQueryRef$curre3 === void 0 || _resultQueryRef$curre3.call(resultQueryRef);
279
- };
280
- var _signature = useRequest(isPay ? linklyPaySignatureApi : linklyRefundSignatureApi, {
281
- manual: true,
282
- onSuccess: function onSuccess(res) {
283
- return signatureAction(res, 'success');
284
- },
285
- onError: function onError(error) {
286
- return signatureAction(error, 'error');
287
- }
288
- });
289
- var linklySignature = function linklySignature(status, resultQuery) {
290
- var _deviceRef$current3;
291
- resultQueryRef.current = resultQuery;
292
- var param = {
293
- // 设备id
294
- pinpad_id: deviceRef === null || deviceRef === void 0 || (_deviceRef$current3 = deviceRef.current) === null || _deviceRef$current3 === void 0 || (_deviceRef$current3 = _deviceRef$current3.metadata) === null || _deviceRef$current3 === void 0 ? void 0 : _deviceRef$current3.linkly_pinpad_id,
295
- // 交易流水号
296
- session_id: numRef.current,
297
- signature_flag: status
298
- };
299
- dispatch(updateStatus(StatusEnum.Loading));
300
- dispatch(updateState({
301
- title: locales.getText('page.eftpos-pay.text.loading')(modeRef.current)
302
- }));
303
- dispatch(updateCustom({
304
- actionStatus: LinklyActionStatus.SignatureWaiting
305
- }));
306
- sendWarningLog({
307
- title: "Linkly-".concat(isPay ? 'Pay' : 'Refund', "-\u7B7E\u540D"),
308
- content: [{
309
- key: 'params',
310
- value: JSON.stringify(param)
311
- }]
312
- });
313
- _signature.run(param);
314
- };
315
- return {
316
- action: {
317
- signature: _signature
318
- },
319
- linklySignature: linklySignature
320
- };
321
- };
@@ -1,4 +0,0 @@
1
- export declare const useTimeResultQuery: (api: any, resultCheck: () => boolean, handleLinklySuccess: (res: any) => void) => {
2
- run: () => Promise<void>;
3
- stop: () => void;
4
- };