修复:收到订单后按订单级触发自动核销
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
resolveOrderFulfillmentReadiness,
|
||||
syncOrderFulfillmentAttachments,
|
||||
} from '../fulfillment/order-fulfillment-readiness-service.js'
|
||||
import { scheduleVoucherConsumeForOrderReceived } from '../fulfillment/voucher-consume-queue-service.js'
|
||||
import { syncWorkerOrdersForSourceOrder } from '../worker-platform/index.js'
|
||||
import {
|
||||
publishAdminOrderRealtimeChange,
|
||||
@@ -212,6 +213,17 @@ export async function upsertOrderFromSource(
|
||||
|
||||
const { order, orderItems } = persisted
|
||||
|
||||
if (String(order.pay_status || '').trim() === 'paid') {
|
||||
await scheduleVoucherConsumeForOrderReceived([Number(order.id)]).catch((error) => {
|
||||
logWarn('[order-service]', '收到订单后安排订单级自动核销失败', {
|
||||
orderId: order.id,
|
||||
provider: order.provider,
|
||||
platformOrderId: order.platform_order_id,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const configuredOrderItems = orderItems.filter(isOrderItemConfiguredForFulfillment)
|
||||
const readiness =
|
||||
configuredOrderItems.length > 0
|
||||
|
||||
Reference in New Issue
Block a user