修复不返回链接错误
This commit is contained in:
@@ -44,7 +44,7 @@ test('parseOpen91ProductNo splits product name and kuaishou shop id by four dash
|
||||
)
|
||||
})
|
||||
|
||||
test('buildOpen91SourceEvent uses productNo suffix as order shop id', () => {
|
||||
test('buildOpen91SourceEvent keeps productNo suffix for kuaishou consume only', () => {
|
||||
const event = buildOpen91SourceEvent({
|
||||
orderNo: 'P91KS202605130002',
|
||||
productNo: '测试-关联商品1----3676797936',
|
||||
@@ -58,7 +58,8 @@ test('buildOpen91SourceEvent uses productNo suffix as order shop id', () => {
|
||||
shopName: '91卡券',
|
||||
})
|
||||
|
||||
assert.equal(event.shopId, '3676797936')
|
||||
assert.equal(event.shopId, '91kaquan')
|
||||
assert.equal(event.shopName, '91卡券')
|
||||
assert.equal(event.items[0].externalItemId, '测试-关联商品1----3676797936')
|
||||
assert.equal(event.items[0].externalSkuCode, '测试-关联商品1----3676797936')
|
||||
assert.equal(event.items[0].externalSkuName, '测试-关联商品1')
|
||||
@@ -67,4 +68,5 @@ test('buildOpen91SourceEvent uses productNo suffix as order shop id', () => {
|
||||
assert.equal(event.items[0].snapshot.productNo, '测试-关联商品1----3676797936')
|
||||
assert.equal(event.items[0].snapshot.productName, '测试-关联商品1')
|
||||
assert.equal(event.items[0].snapshot.shopId, '3676797936')
|
||||
assert.equal(event.items[0].spec.shopId, '3676797936')
|
||||
})
|
||||
|
||||
@@ -12,7 +12,6 @@ import { buildOpen91OutTradeNo } from '../../open-91/response.js'
|
||||
import { createHttpError } from '../../../utils/http.js'
|
||||
import { parseAmountToFen } from '../../../utils/money.js'
|
||||
import { nowIso } from '../../../utils/time.js'
|
||||
import { findKuaishouEticketShopConfig } from '../kuaishou-eticket/source-config-service.js'
|
||||
import type { OrderItemRow, OrderRow } from '../../../types/repository/rows.js'
|
||||
|
||||
export const OPEN_91_PENDING_CONFIG_STATUS = 'pending_config'
|
||||
@@ -25,9 +24,8 @@ export function buildOpen91SourceEvent(payload: JsonObject = {}, config: JsonObj
|
||||
const productInfo = parseOpen91ProductNo(normalized.productNo)
|
||||
const productNo = productInfo.rawProductNo
|
||||
const productName = productInfo.productName
|
||||
const shopId = productInfo.shopId || String(config.shopId || OPEN_91_PROVIDER).trim() || OPEN_91_PROVIDER
|
||||
const shopConfig = productInfo.shopId ? findKuaishouEticketShopConfig(productInfo.shopId) : null
|
||||
const shopName = String(shopConfig?.kshopName || config.shopName || '91卡券').trim() || '91卡券'
|
||||
const shopId = String(config.shopId || OPEN_91_PROVIDER).trim() || OPEN_91_PROVIDER
|
||||
const shopName = String(config.shopName || '91卡券').trim() || '91卡券'
|
||||
const maxAmountFen = parseAmountToFen(normalized.maxAmount)
|
||||
|
||||
return {
|
||||
@@ -336,8 +334,10 @@ function buildOpen91SourceEventFromOrder(order: OrderRow, items: OrderItemRow[]
|
||||
return {
|
||||
provider: order.provider,
|
||||
platform: order.platform,
|
||||
shopId: order.shop_id,
|
||||
shopName: order.shop_name,
|
||||
shopId: OPEN_91_PROVIDER,
|
||||
shopName: String(order.shop_id || '').trim() === OPEN_91_PROVIDER
|
||||
? order.shop_name
|
||||
: '91卡券',
|
||||
platformOrderId: order.platform_order_id,
|
||||
orderStatus: 'paid',
|
||||
payStatus: 'paid',
|
||||
|
||||
Reference in New Issue
Block a user