feat: 支持第三方卡券收到订单后自动核销
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
planInternalSkuChannels,
|
||||
type InternalSkuChannelRow,
|
||||
} from './internal-sku-channel-service.js'
|
||||
import { scheduleVoucherConsumeForOrderItems } from './voucher-consume-queue-service.js'
|
||||
|
||||
type CarrierCandidate = {
|
||||
id: number
|
||||
@@ -188,7 +189,13 @@ async function selectSafeFallback(input: {
|
||||
input.includeAssignedMissingCarrier,
|
||||
],
|
||||
)
|
||||
return (result.rowCount || 0) > 0
|
||||
const updated = (result.rowCount || 0) > 0
|
||||
if (updated) {
|
||||
await scheduleVoucherConsumeForOrderItems([input.orderItemId], 'order_received').catch(
|
||||
() => undefined,
|
||||
)
|
||||
}
|
||||
return updated
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user