@pisell/pisellos 2.2.133 → 2.2.134

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.
@@ -76,6 +76,13 @@ function generateRequestUniqueId() {
76
76
 
77
77
  return "".concat(year).concat(month).concat(day).concat(hour).concat(minute).concat(second).concat(millisecond).concat(randomDigits);
78
78
  }
79
+ function normalizeCustomPaymentId(paymentItem) {
80
+ var _ref, _paymentItem$custom_p;
81
+ var rawId = (_ref = (_paymentItem$custom_p = paymentItem.custom_payment_id) !== null && _paymentItem$custom_p !== void 0 ? _paymentItem$custom_p : paymentItem.id) !== null && _ref !== void 0 ? _ref : 0;
82
+ var parsedId = Number(rawId);
83
+ if (!Number.isFinite(parsedId)) return 0;
84
+ return parsedId;
85
+ }
79
86
 
80
87
  /**
81
88
  * 支付模块实现
@@ -297,7 +304,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
297
304
  var network = this.app.plugins.get('network');
298
305
  this.logInfo('Registering network status listener');
299
306
  network === null || network === void 0 || network.addListener('networkStatusChange', /*#__PURE__*/function () {
300
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(status) {
307
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(status) {
301
308
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
302
309
  while (1) switch (_context2.prev = _context2.next) {
303
310
  case 0:
@@ -317,7 +324,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
317
324
  }, _callee2);
318
325
  }));
319
326
  return function (_x3) {
320
- return _ref.apply(this, arguments);
327
+ return _ref2.apply(this, arguments);
321
328
  };
322
329
  }());
323
330
  }
@@ -1251,12 +1258,14 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1251
1258
  currentTime = formatDateTime(new Date());
1252
1259
  newPaymentItem = {
1253
1260
  uuid: paymentUuid,
1254
- custom_payment_id: paymentItem.custom_payment_id || 0,
1261
+ custom_payment_id: normalizeCustomPaymentId(paymentItem),
1255
1262
  name: paymentItem.name,
1256
1263
  code: paymentItem.code,
1257
1264
  type: paymentItem.type,
1258
1265
  amount: formatAmount(paymentItem.amount),
1259
1266
  voucher_id: paymentItem.voucher_id || '',
1267
+ wallet_pass_usage_unit: paymentItem.wallet_pass_usage_unit,
1268
+ wallet_pass_use_value: paymentItem.wallet_pass_use_value,
1260
1269
  rounding_amount: paymentItem.rounding_amount || '0.00',
1261
1270
  service_charge: paymentItem.service_charge,
1262
1271
  status: 'active',
@@ -104,7 +104,11 @@ export interface PaymentItem {
104
104
  /** 支付类型type,跟支付列表上对应的支付方式保持一致 */
105
105
  type: string;
106
106
  /** 代金券、充值卡、积分卡等wallet pass id */
107
- voucher_id?: string;
107
+ voucher_id?: string | number;
108
+ /** Wallet Pass 使用单位配置 */
109
+ wallet_pass_usage_unit?: unknown;
110
+ /** Wallet Pass 本次使用值 */
111
+ wallet_pass_use_value?: string | number | null;
108
112
  /** 拓展参数字段 */
109
113
  metadata?: {
110
114
  /** 钱箱 ID */
@@ -227,13 +231,19 @@ export interface PaymentItemInput {
227
231
  /** 支付类型,跟支付列表上对应的支付方式保持一致 */
228
232
  code: string;
229
233
  /** 支付类型id,跟支付列表上对应的支付方式保持一致 */
230
- custom_payment_id: number;
234
+ custom_payment_id?: string | number;
235
+ /** 兼容旧调用方传入的支付方式 id */
236
+ id?: string | number;
231
237
  /** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
232
238
  name: string;
233
239
  /** 支付类型type,跟支付列表上对应的支付方式保持一致 */
234
240
  type: string;
235
241
  /** 代金券、充值卡、积分卡等wallet pass id */
236
- voucher_id?: string;
242
+ voucher_id?: string | number;
243
+ /** Wallet Pass 使用单位配置 */
244
+ wallet_pass_usage_unit?: unknown;
245
+ /** Wallet Pass 本次使用值 */
246
+ wallet_pass_use_value?: string | number | null;
237
247
  /** 三方支付手续费 */
238
248
  service_charge?: {
239
249
  percentage?: string;
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -62,6 +62,13 @@ function generateRequestUniqueId() {
62
62
  const randomDigits = Math.floor(Math.random() * 9e3) + 1e3;
63
63
  return `${year}${month}${day}${hour}${minute}${second}${millisecond}${randomDigits}`;
64
64
  }
65
+ function normalizeCustomPaymentId(paymentItem) {
66
+ const rawId = paymentItem.custom_payment_id ?? paymentItem.id ?? 0;
67
+ const parsedId = Number(rawId);
68
+ if (!Number.isFinite(parsedId))
69
+ return 0;
70
+ return parsedId;
71
+ }
65
72
  var PaymentModule = class extends import_BaseModule.BaseModule {
66
73
  constructor(name, version) {
67
74
  super(name || "payment", version);
@@ -633,12 +640,14 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
633
640
  const currentTime = formatDateTime(/* @__PURE__ */ new Date());
634
641
  const newPaymentItem = {
635
642
  uuid: paymentUuid,
636
- custom_payment_id: paymentItem.custom_payment_id || 0,
643
+ custom_payment_id: normalizeCustomPaymentId(paymentItem),
637
644
  name: paymentItem.name,
638
645
  code: paymentItem.code,
639
646
  type: paymentItem.type,
640
647
  amount: formatAmount(paymentItem.amount),
641
648
  voucher_id: paymentItem.voucher_id || "",
649
+ wallet_pass_usage_unit: paymentItem.wallet_pass_usage_unit,
650
+ wallet_pass_use_value: paymentItem.wallet_pass_use_value,
642
651
  rounding_amount: paymentItem.rounding_amount || "0.00",
643
652
  service_charge: paymentItem.service_charge,
644
653
  status: "active",
@@ -104,7 +104,11 @@ export interface PaymentItem {
104
104
  /** 支付类型type,跟支付列表上对应的支付方式保持一致 */
105
105
  type: string;
106
106
  /** 代金券、充值卡、积分卡等wallet pass id */
107
- voucher_id?: string;
107
+ voucher_id?: string | number;
108
+ /** Wallet Pass 使用单位配置 */
109
+ wallet_pass_usage_unit?: unknown;
110
+ /** Wallet Pass 本次使用值 */
111
+ wallet_pass_use_value?: string | number | null;
108
112
  /** 拓展参数字段 */
109
113
  metadata?: {
110
114
  /** 钱箱 ID */
@@ -227,13 +231,19 @@ export interface PaymentItemInput {
227
231
  /** 支付类型,跟支付列表上对应的支付方式保持一致 */
228
232
  code: string;
229
233
  /** 支付类型id,跟支付列表上对应的支付方式保持一致 */
230
- custom_payment_id: number;
234
+ custom_payment_id?: string | number;
235
+ /** 兼容旧调用方传入的支付方式 id */
236
+ id?: string | number;
231
237
  /** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
232
238
  name: string;
233
239
  /** 支付类型type,跟支付列表上对应的支付方式保持一致 */
234
240
  type: string;
235
241
  /** 代金券、充值卡、积分卡等wallet pass id */
236
- voucher_id?: string;
242
+ voucher_id?: string | number;
243
+ /** Wallet Pass 使用单位配置 */
244
+ wallet_pass_usage_unit?: unknown;
245
+ /** Wallet Pass 本次使用值 */
246
+ wallet_pass_use_value?: string | number | null;
237
247
  /** 三方支付手续费 */
238
248
  service_charge?: {
239
249
  percentage?: string;
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.133",
4
+ "version": "2.2.134",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",