@pisell/private-materials 6.4.8 → 6.4.10

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.
@@ -185,13 +185,13 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
185
185
  // 从支付方式列表中查找现金支付方式
186
186
  cashPaymentMethod = paymentMethods.find(function (method) {
187
187
  var _method$name;
188
- return method.code === 'cash' || method.type === 'cash' || ((_method$name = method.name) === null || _method$name === void 0 ? void 0 : _method$name.toLowerCase().includes('cash'));
188
+ return method.code === 'CASHMANUAL' || method.type === 'CASHMANUAL' || ((_method$name = method.name) === null || _method$name === void 0 ? void 0 : _method$name.toLowerCase().includes('cash'));
189
189
  });
190
190
  _context.next = 3;
191
191
  return checkoutModule === null || checkoutModule === void 0 ? void 0 : checkoutModule.addPaymentItemAsync({
192
192
  amount: result.amount,
193
193
  /** 支付类型,跟支付列表上对应的支付方式保持一致 */
194
- code: result.type,
194
+ code: cashPaymentMethod === null || cashPaymentMethod === void 0 ? void 0 : cashPaymentMethod.code,
195
195
  /** 支付类型id,跟支付列表上对应的支付方式保持一致 */
196
196
  id: cashPaymentMethod === null || cashPaymentMethod === void 0 ? void 0 : cashPaymentMethod.id,
197
197
  /** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
@@ -532,12 +532,16 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
532
532
  }
533
533
  // 判断是否为现金支付
534
534
  var paymentMethodName = data.paymentMethodName || data.name || '';
535
- var isCashPayment = data.paymentMethodCode === 'cash' || data.paymentMethodCode === 'CASH' || /现金|現金/i.test(paymentMethodName) || /cash/i.test(paymentMethodName);
535
+ var isCashPayment = data.paymentMethodCode === 'CASHMANUAL' || /现金|現金/i.test(paymentMethodName) || /cash/i.test(paymentMethodName);
536
536
  if (isCashPayment) {
537
- var _interaction$utils, _interaction$utils$as;
537
+ var _interaction$utils, _interaction$utils$po;
538
+ logger === null || logger === void 0 || logger.addLog({
539
+ type: 'info',
540
+ title: 'open_till',
541
+ metadata: {}
542
+ });
538
543
  // handleToastClose();
539
- // TODO: 等红阳的方法
540
- interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$as = _interaction$utils.asyncDataManager) === null || _interaction$utils$as === void 0 || _interaction$utils$as.call(_interaction$utils, {
544
+ interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 || _interaction$utils$po.call(_interaction$utils, {
541
545
  module: 'till',
542
546
  key: 'open_till'
543
547
  });
@@ -636,7 +640,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
636
640
  // 当 walletpass 直接就满足订单支付时,触发此方法
637
641
  var handleWalletPassConfirmPay = /*#__PURE__*/function () {
638
642
  var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(action) {
639
- var result, _result$response, responseData, _responseData$payment, _responseData$payment2, params;
643
+ var result, _result$response, responseData, _responseData$payment, params;
640
644
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
641
645
  while (1) switch (_context7.prev = _context7.next) {
642
646
  case 0:
@@ -670,8 +674,8 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
670
674
  // 打印订单全部信息
671
675
  data: {
672
676
  order_id: responseData.order_id,
673
- machine_code_print_info: responseData === null || responseData === void 0 || (_responseData$payment = responseData.payment_info) === null || _responseData$payment === void 0 ? void 0 : _responseData$payment.machine_code_info,
674
- small_ticket_data: responseData === null || responseData === void 0 || (_responseData$payment2 = responseData.payment_info) === null || _responseData$payment2 === void 0 ? void 0 : _responseData$payment2.small_ticket_data
677
+ machine_code_print_info: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info,
678
+ small_ticket_data: responseData === null || responseData === void 0 || (_responseData$payment = responseData.payment_info) === null || _responseData$payment === void 0 ? void 0 : _responseData$payment.small_ticket_data
675
679
  }
676
680
  };
677
681
  console.log('print_order_onOrderSynced_params>>>>', params);
@@ -1642,7 +1646,7 @@ var PaymentModal = function PaymentModal(_ref17) {
1642
1646
  setOrderInfo(_orderInfo2);
1643
1647
  // 监听订单同步完成,同步完成后显示订单完成 toast,关闭当前弹窗
1644
1648
  unsubscribeRef.current = checkout.core.effects.on('checkout:onOrderSynced', function (data) {
1645
- var _data$response, _responseData$payment3;
1649
+ var _data$response, _responseData$payment2;
1646
1650
  // 获取支付状态和相关信息
1647
1651
  var responseData = (_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.data;
1648
1652
  // 获取支付状态
@@ -1657,7 +1661,7 @@ var PaymentModal = function PaymentModal(_ref17) {
1657
1661
  // 获取订单总金额
1658
1662
  var orderTotalAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.total_amount) || 0);
1659
1663
  var gapAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.amount_gap) || 0);
1660
- var currentChangeGivenAmount = Number((responseData === null || responseData === void 0 || (_responseData$payment3 = responseData.payment_info) === null || _responseData$payment3 === void 0 ? void 0 : _responseData$payment3.current_change_given_amount) || 0);
1664
+ var currentChangeGivenAmount = Number((responseData === null || responseData === void 0 || (_responseData$payment2 = responseData.payment_info) === null || _responseData$payment2 === void 0 ? void 0 : _responseData$payment2.current_change_given_amount) || 0);
1661
1665
  // const changeDue = Number(responseData?.amount_gap || 0);
1662
1666
  // 获取失败原因
1663
1667
  var failureReason = responseData === null || responseData === void 0 ? void 0 : responseData.failure_reason;
@@ -1667,14 +1671,15 @@ var PaymentModal = function PaymentModal(_ref17) {
1667
1671
  // 打印订单完整信息
1668
1672
  console.log('print_order_onOrderSynced>>>>', responseData);
1669
1673
  try {
1670
- var _responseData$payment4, _responseData$payment5;
1674
+ var _responseData$payment3;
1675
+ debugger;
1671
1676
  var params = {
1672
1677
  type: '99',
1673
1678
  // 打印订单全部信息
1674
1679
  data: {
1675
1680
  order_id: responseData.order_id,
1676
- machine_code_print_info: responseData === null || responseData === void 0 || (_responseData$payment4 = responseData.payment_info) === null || _responseData$payment4 === void 0 ? void 0 : _responseData$payment4.machine_code_info,
1677
- small_ticket_data: responseData === null || responseData === void 0 || (_responseData$payment5 = responseData.payment_info) === null || _responseData$payment5 === void 0 ? void 0 : _responseData$payment5.small_ticket_data
1681
+ machine_code_print_info: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info,
1682
+ small_ticket_data: responseData === null || responseData === void 0 || (_responseData$payment3 = responseData.payment_info) === null || _responseData$payment3 === void 0 ? void 0 : _responseData$payment3.small_ticket_data
1678
1683
  }
1679
1684
  };
1680
1685
  console.log('print_order_onOrderSynced_params>>>>', params);
@@ -88,7 +88,7 @@ export function CashPaymentModule(_ref) {
88
88
  }
89
89
  var finalAmount = typeof amount === 'number' ? amount : Number(amount) || 0;
90
90
  onPaymentComplete({
91
- type: 'cash',
91
+ type: 'CASHMANUAL',
92
92
  amount: finalAmount,
93
93
  totalAmount: Number(customAmount) || 0,
94
94
  change: finalAmount - (Number(customAmount) || 0),
@@ -144,13 +144,13 @@ var PaymentContent = (0, import_react.forwardRef)(
144
144
  const cashPaymentMethod = paymentMethods.find(
145
145
  (method) => {
146
146
  var _a2;
147
- return method.code === "cash" || method.type === "cash" || ((_a2 = method.name) == null ? void 0 : _a2.toLowerCase().includes("cash"));
147
+ return method.code === "CASHMANUAL" || method.type === "CASHMANUAL" || ((_a2 = method.name) == null ? void 0 : _a2.toLowerCase().includes("cash"));
148
148
  }
149
149
  );
150
150
  await (checkoutModule == null ? void 0 : checkoutModule.addPaymentItemAsync({
151
151
  amount: result.amount,
152
152
  /** 支付类型,跟支付列表上对应的支付方式保持一致 */
153
- code: result.type,
153
+ code: cashPaymentMethod == null ? void 0 : cashPaymentMethod.code,
154
154
  /** 支付类型id,跟支付列表上对应的支付方式保持一致 */
155
155
  id: cashPaymentMethod == null ? void 0 : cashPaymentMethod.id,
156
156
  /** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
@@ -427,9 +427,14 @@ var PaymentContent = (0, import_react.forwardRef)(
427
427
  );
428
428
  }
429
429
  const paymentMethodName = data.paymentMethodName || data.name || "";
430
- const isCashPayment = data.paymentMethodCode === "cash" || data.paymentMethodCode === "CASH" || /现金|現金/i.test(paymentMethodName) || /cash/i.test(paymentMethodName);
430
+ const isCashPayment = data.paymentMethodCode === "CASHMANUAL" || /现金|現金/i.test(paymentMethodName) || /cash/i.test(paymentMethodName);
431
431
  if (isCashPayment) {
432
- (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.asyncDataManager) == null ? void 0 : _b2.call(_a2, {
432
+ logger == null ? void 0 : logger.addLog({
433
+ type: "info",
434
+ title: "open_till",
435
+ metadata: {}
436
+ });
437
+ (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b2.call(_a2, {
433
438
  module: "till",
434
439
  key: "open_till"
435
440
  });
@@ -489,7 +494,7 @@ var PaymentContent = (0, import_react.forwardRef)(
489
494
  [checkoutModule]
490
495
  );
491
496
  const handleWalletPassConfirmPay = async (action) => {
492
- var _a2, _b2, _c2;
497
+ var _a2, _b2;
493
498
  if (action === "save-without-deduct") {
494
499
  await checkoutModule.updateVoucherPaymentItemsAsync([]);
495
500
  } else if (action === "cancel") {
@@ -506,8 +511,8 @@ var PaymentContent = (0, import_react.forwardRef)(
506
511
  // 打印订单全部信息
507
512
  data: {
508
513
  order_id: responseData.order_id,
509
- machine_code_print_info: (_b2 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _b2.machine_code_info,
510
- small_ticket_data: (_c2 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _c2.small_ticket_data
514
+ machine_code_print_info: responseData == null ? void 0 : responseData.machine_code_print_info,
515
+ small_ticket_data: (_b2 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _b2.small_ticket_data
511
516
  }
512
517
  };
513
518
  console.log("print_order_onOrderSynced_params>>>>", params);
@@ -1220,7 +1225,7 @@ var PaymentModal = ({
1220
1225
  }
1221
1226
  setOrderInfo(orderInfo2);
1222
1227
  unsubscribeRef.current = checkout.core.effects.on("checkout:onOrderSynced", (data2) => {
1223
- var _a3, _b3, _c2, _d2;
1228
+ var _a3, _b3, _c2;
1224
1229
  const responseData = (_a3 = data2.response) == null ? void 0 : _a3.data;
1225
1230
  const paymentStatus = responseData == null ? void 0 : responseData.payment_status;
1226
1231
  if (data2.isManual) return;
@@ -1237,13 +1242,14 @@ var PaymentModal = ({
1237
1242
  if (paymentStatus) {
1238
1243
  console.log("print_order_onOrderSynced>>>>", responseData);
1239
1244
  try {
1245
+ debugger;
1240
1246
  const params = {
1241
1247
  type: "99",
1242
1248
  // 打印订单全部信息
1243
1249
  data: {
1244
1250
  order_id: responseData.order_id,
1245
- machine_code_print_info: (_c2 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _c2.machine_code_info,
1246
- small_ticket_data: (_d2 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _d2.small_ticket_data
1251
+ machine_code_print_info: responseData == null ? void 0 : responseData.machine_code_print_info,
1252
+ small_ticket_data: (_c2 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _c2.small_ticket_data
1247
1253
  }
1248
1254
  };
1249
1255
  console.log("print_order_onOrderSynced_params>>>>", params);
@@ -92,7 +92,7 @@ function CashPaymentModule({
92
92
  }
93
93
  const finalAmount = typeof amount === "number" ? amount : Number(amount) || 0;
94
94
  onPaymentComplete({
95
- type: "cash",
95
+ type: "CASHMANUAL",
96
96
  amount: finalAmount,
97
97
  totalAmount: Number(customAmount) || 0,
98
98
  change: finalAmount - (Number(customAmount) || 0),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.4.8",
3
+ "version": "6.4.10",
4
4
  "scripts": {
5
5
  "dev": "father dev",
6
6
  "build": "father build",