@intercartx/booster-core 0.0.1-beta.24 → 0.0.1-beta.26

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.
@@ -24,7 +24,7 @@ interface BaseOrderProduct {
24
24
  price: number | string;
25
25
  originPrice: number | string;
26
26
  discount: number;
27
- sku?: string;
27
+ productId?: string;
28
28
  }[];
29
29
  }
30
30
  interface OneTimeOrderProduct extends BaseOrderProduct {
@@ -17,7 +17,7 @@ export class OrderSummaryModel extends BusinessModel {
17
17
  this.displayProductList = productInfo.display.map(product => ({
18
18
  ...product,
19
19
  price: divide100(product.price),
20
- originPrice: divide100(product.originPrice),
20
+ originPrice: divide100(product.originPrice, 4),
21
21
  }));
22
22
  globalState.on(CheckoutEvents.FEE_UPDATE, (feesData) => {
23
23
  this.fees = Object.fromEntries(Object.entries(feesData.feeDetail).map(([key, value]) => [
@@ -10,6 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _PayButtonModel_instances, _PayButtonModel_paymentConfig, _PayButtonModel_createPaymentHandler;
13
+ import { TracksityTracker, tracksityTracker } from "../../../utils/tracksity";
13
14
  import { HTTPError, ResponseErrorCode } from "../../../api";
14
15
  import { CheckoutEvents } from "../../../types";
15
16
  import { globalState } from "../../GlobalState";
@@ -49,9 +50,18 @@ export class PayButtonModel extends BusinessModel {
49
50
  return this.paymentHandler.preparePaymentData();
50
51
  }
51
52
  async handlePayment() {
53
+ var _a;
52
54
  try {
53
55
  globalState.emit(CheckoutEvents.ERROR_TIP_SHOW, '');
54
56
  await this.paymentHandler.handlePayment();
57
+ const config = ((_a = globalState.getConfig().processorData.productInfo) === null || _a === void 0 ? void 0 : _a.display) || [];
58
+ const contents = config.map((item) => ({
59
+ content_id: item.productId || '',
60
+ content_name: item.title || '',
61
+ price: Number(item.price),
62
+ quantity: Number(item.quantity),
63
+ }));
64
+ tracksityTracker.event("PlaceAnOrder", TracksityTracker.buildEcommerceData(contents));
55
65
  }
56
66
  catch (error) {
57
67
  if (error instanceof HTTPError) {
@@ -167,7 +167,7 @@ export class FxpCCPaymentHandler extends BaseCCPaymentHandler {
167
167
  if (prev.length >= 0) {
168
168
  prev += `#;#`;
169
169
  }
170
- return prev + `${(_a = curr.title) !== null && _a !== void 0 ? _a : '0'}#,#${(_b = curr.sku) !== null && _b !== void 0 ? _b : '0'}#,#${orderAmount}#,#${(_c = curr.quantity) !== null && _c !== void 0 ? _c : '0'}`;
170
+ return prev + `${(_a = curr.title) !== null && _a !== void 0 ? _a : '0'}#,#${(_b = curr.productId) !== null && _b !== void 0 ? _b : '0'}#,#${orderAmount}#,#${(_c = curr.quantity) !== null && _c !== void 0 ? _c : '0'}`;
171
171
  }, '');
172
172
  const fxpReqData = [
173
173
  { name: "merNo", value: rest.merNo },
@@ -23,7 +23,7 @@ export class CCPaymentModel extends BusinessModel {
23
23
  if (this.cardNumber.validate()) {
24
24
  const config = ((_a = globalState.getConfig().processorData.productInfo) === null || _a === void 0 ? void 0 : _a.display) || [];
25
25
  const contents = config.map(item => ({
26
- content_id: item.sku || '',
26
+ content_id: item.productId || '',
27
27
  content_name: item.title || '',
28
28
  price: Number(item.price),
29
29
  quantity: Number(item.quantity),
@@ -37,7 +37,7 @@ export class FxpCCPaymentModel extends BusinessModel {
37
37
  var _a;
38
38
  const config = ((_a = globalState.getConfig().processorData.productInfo) === null || _a === void 0 ? void 0 : _a.display) || [];
39
39
  const contents = config.map(item => ({
40
- content_id: item.sku || '',
40
+ content_id: item.productId || '',
41
41
  content_name: item.title || '',
42
42
  price: Number(item.price),
43
43
  quantity: Number(item.quantity),
@@ -127,7 +127,7 @@ export class StripeCCPaymentModel extends BusinessModel {
127
127
  // TODO: 处理支付完成事件
128
128
  const config = ((_a = globalState.getConfig().processorData.productInfo) === null || _a === void 0 ? void 0 : _a.display) || [];
129
129
  const contents = config.map(item => ({
130
- content_id: item.sku || '',
130
+ content_id: item.productId || '',
131
131
  content_name: item.title || '',
132
132
  price: Number(item.price),
133
133
  quantity: Number(item.quantity),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intercartx/booster-core",
3
- "version": "0.0.1-beta.24",
3
+ "version": "0.0.1-beta.26",
4
4
  "description": "核心功能库,提供结账系统的业务逻辑、数据模型、验证工具、API 接口和样式文件",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",