@pisell/pisellos 2.2.14 → 2.2.15

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.
@@ -193,31 +193,33 @@ var OrderModule = class extends import_BaseModule.BaseModule {
193
193
  * @returns 后端返回的订单数据(包含订单ID等)
194
194
  */
195
195
  async createOrderByCheckout(params) {
196
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
196
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
197
+ const onlineStorePaymentCodeList = ["WXPAY", "WECHAT", "ALIPAY", "APPLE_PAY", "CREDIT_CARD_3DS", "CREDIT_CARD_TOKEN", "GOOGLE_PAY", "GOOGLE_PAY_3DS", "CREDIT_CARD"];
198
+ params.payments = (_a = params.payments) == null ? void 0 : _a.filter((p) => !onlineStorePaymentCodeList.includes(p.code));
197
199
  this.logInfo("createOrderByCheckout called", {
198
200
  type: params.type,
199
201
  platform: params.platform,
200
202
  is_deposit: params.is_deposit,
201
203
  customer_id: params.customer_id,
202
- bookingsCount: ((_a = params.bookings) == null ? void 0 : _a.length) || 0,
203
- relationProductsCount: ((_b = params.relation_products) == null ? void 0 : _b.length) || 0,
204
- paymentsCount: ((_c = params.payments) == null ? void 0 : _c.length) || 0,
204
+ bookingsCount: ((_b = params.bookings) == null ? void 0 : _b.length) || 0,
205
+ relationProductsCount: ((_c = params.relation_products) == null ? void 0 : _c.length) || 0,
206
+ paymentsCount: ((_d = params.payments) == null ? void 0 : _d.length) || 0,
205
207
  depositAmount: params.deposit_amount,
206
208
  productTaxFee: params.product_tax_fee,
207
209
  note: params.note,
208
210
  scheduleDate: params.schedule_date,
209
211
  hasOrderId: !!params.order_id,
210
212
  orderIdIncluded: params.order_id,
211
- paymentMethods: ((_d = params.payments) == null ? void 0 : _d.map((p) => p.code)) || []
213
+ paymentMethods: ((_e = params.payments) == null ? void 0 : _e.map((p) => p.code)) || []
212
214
  });
213
215
  console.log("[Order] createOrderByCheckout 开始创建订单:", {
214
216
  type: params.type,
215
217
  platform: params.platform,
216
218
  is_deposit: params.is_deposit,
217
219
  customer_id: params.customer_id,
218
- bookingsCount: ((_e = params.bookings) == null ? void 0 : _e.length) || 0,
219
- relationProductsCount: ((_f = params.relation_products) == null ? void 0 : _f.length) || 0,
220
- paymentsCount: ((_g = params.payments) == null ? void 0 : _g.length) || 0
220
+ bookingsCount: ((_f = params.bookings) == null ? void 0 : _f.length) || 0,
221
+ relationProductsCount: ((_g = params.relation_products) == null ? void 0 : _g.length) || 0,
222
+ paymentsCount: ((_h = params.payments) == null ? void 0 : _h.length) || 0
221
223
  });
222
224
  try {
223
225
  const orderData = {
@@ -234,7 +236,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
234
236
  ...params
235
237
  // 使用传入的参数覆盖默认值
236
238
  };
237
- if ((_h = orderData.payments) == null ? void 0 : _h.length) {
239
+ if ((_i = orderData.payments) == null ? void 0 : _i.length) {
238
240
  orderData.small_ticket_data_flag = 1;
239
241
  }
240
242
  if (!params.order_id && !orderData.schedule_date) {
@@ -246,10 +248,10 @@ var OrderModule = class extends import_BaseModule.BaseModule {
246
248
  platform: orderData.platform,
247
249
  isDeposit: orderData.is_deposit,
248
250
  customerId: orderData.customer_id,
249
- bookingsCount: ((_i = orderData.bookings) == null ? void 0 : _i.length) || 0,
250
- relationProductsCount: ((_j = orderData.relation_products) == null ? void 0 : _j.length) || 0,
251
- paymentsCount: ((_k = orderData.payments) == null ? void 0 : _k.length) || 0,
252
- paymentsMethods: ((_l = orderData.payments) == null ? void 0 : _l.map((p) => p.code)) || []
251
+ bookingsCount: ((_j = orderData.bookings) == null ? void 0 : _j.length) || 0,
252
+ relationProductsCount: ((_k = orderData.relation_products) == null ? void 0 : _k.length) || 0,
253
+ paymentsCount: ((_l = orderData.payments) == null ? void 0 : _l.length) || 0,
254
+ paymentsMethods: ((_m = orderData.payments) == null ? void 0 : _m.map((p) => p.code)) || []
253
255
  });
254
256
  this.logInfo("Calling backend checkout API", {
255
257
  url: "/order/checkout",
@@ -258,10 +260,10 @@ var OrderModule = class extends import_BaseModule.BaseModule {
258
260
  isDeposit: orderData.is_deposit,
259
261
  customerId: orderData.customer_id,
260
262
  depositAmount: orderData.deposit_amount,
261
- bookingsCount: ((_m = orderData.bookings) == null ? void 0 : _m.length) || 0,
262
- relationProductsCount: ((_n = orderData.relation_products) == null ? void 0 : _n.length) || 0,
263
- paymentsCount: ((_o = orderData.payments) == null ? void 0 : _o.length) || 0,
264
- paymentMethods: ((_p = orderData.payments) == null ? void 0 : _p.map((p) => ({
263
+ bookingsCount: ((_n = orderData.bookings) == null ? void 0 : _n.length) || 0,
264
+ relationProductsCount: ((_o = orderData.relation_products) == null ? void 0 : _o.length) || 0,
265
+ paymentsCount: ((_p = orderData.payments) == null ? void 0 : _p.length) || 0,
266
+ paymentMethods: ((_q = orderData.payments) == null ? void 0 : _q.map((p) => ({
265
267
  code: p.code,
266
268
  amount: p.amount,
267
269
  type: p.type,
@@ -280,7 +282,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
280
282
  });
281
283
  console.log("[Order] 订单创建成功,后端响应:", {
282
284
  success: !!response,
283
- hasOrderId: !!(((_q = response == null ? void 0 : response.data) == null ? void 0 : _q.order_id) || (response == null ? void 0 : response.order_id))
285
+ hasOrderId: !!(((_r = response == null ? void 0 : response.data) == null ? void 0 : _r.order_id) || (response == null ? void 0 : response.order_id))
284
286
  });
285
287
  return response;
286
288
  } catch (error) {
@@ -50,6 +50,7 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
50
50
  *
51
51
  */
52
52
  private registerNetworkHandlers;
53
+ private filterPayMethods;
53
54
  /**
54
55
  * 获取支付方式列表
55
56
  */
@@ -175,6 +175,20 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
175
175
  }
176
176
  });
177
177
  }
178
+ async filterPayMethods(payMethods) {
179
+ payMethods.filter((method) => method.status === 1 && method.disable === 0);
180
+ const walletPassMethod = payMethods.find((method) => method.code === "WALLET_PASS");
181
+ if (walletPassMethod) {
182
+ payMethods.forEach((method) => {
183
+ if (method.code === "PRODUCTVOUCHER" || method.code === "GIFTCARD" || method.code === "POINTCARD") {
184
+ method.channel_application = walletPassMethod.channel_application;
185
+ }
186
+ });
187
+ } else {
188
+ payMethods = payMethods.filter((method) => method.code !== "PRODUCTVOUCHER" && method.code !== "GIFTCARD" && method.code !== "POINTCARD");
189
+ }
190
+ return payMethods;
191
+ }
178
192
  /**
179
193
  * 获取支付方式列表
180
194
  */
@@ -193,7 +207,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
193
207
  return cachedMethods;
194
208
  }
195
209
  const response = await this.request.get("/pay/custom-payment/all");
196
- response.data = response.data.filter((method) => method.status === 1 && method.disable === 0);
210
+ response.data = this.filterPayMethods(response.data);
197
211
  const payMethods = response.data || [];
198
212
  try {
199
213
  for (const method of payMethods) {
@@ -227,7 +241,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
227
241
  try {
228
242
  console.log("[PaymentModule] 后台刷新支付方式列表...");
229
243
  const response = await this.request.get("/pay/custom-payment/all");
230
- response.data = response.data.filter((method) => method.status === 1 && method.disable === 0);
244
+ response.data = this.filterPayMethods(response.data);
231
245
  const newPayMethods = response.data || [];
232
246
  const hasChanges = this.hasPaymentMethodsChanged(
233
247
  cachedMethods,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.14",
4
+ "version": "2.2.15",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",