fix: coordinate SMS completion and improve operations diagnostics
CSS quality / css-quality (push) Has been cancelled

This commit is contained in:
hectorzhao
2026-09-16 18:27:29 +08:00
parent a0209f93bc
commit a350aca883
40 changed files with 2599 additions and 366 deletions
@@ -1694,6 +1694,7 @@ describe('SendChainService', () => {
applicationId: 'app-1',
eventType: 'receipt',
}),
undefined,
);
expect(prisma.cmppDownstreamDelivery.create).not.toHaveBeenCalled();
});
@@ -3257,7 +3258,7 @@ describe('SendChainService', () => {
data: expect.objectContaining({ sequenceId: 7, gatewayMessageId: 'GW-1', submitStatus: 'accepted' }),
});
expect(prisma.smsMessageRecord.updateMany).toHaveBeenCalledWith({
where: { id: 'record-1', status: { notIn: ['delivered', 'failed', 'unknown'] } },
where: { id: 'record-1', status: { notIn: ['delivered', 'failed', 'unknown', 'timeout'] } },
data: expect.objectContaining({ gatewayMessageId: 'GW-1', status: 'submitted', submitStatus: 'accepted' }),
});
expect(billing.settleFrozenCharge).toHaveBeenCalledWith(
@@ -4891,7 +4892,7 @@ describe('SendChainService', () => {
expect(prisma.smsMessageRecord.updateMany).toHaveBeenNthCalledWith(
1,
expect.objectContaining({
where: { id: 'record-1', status: { notIn: ['delivered', 'failed', 'unknown'] } },
where: { id: 'record-1', status: { notIn: ['delivered', 'failed', 'unknown', 'timeout'] } },
data: expect.objectContaining({ status: 'submitted' }),
}),
);
@@ -5567,6 +5568,7 @@ describe('SendChainService', () => {
errorCode: 'RECEIPT_TIMEOUT',
}),
}),
undefined,
);
expect(prisma.cmppDownstreamDelivery.create).not.toHaveBeenCalled();
expect(prisma.smsMessageRecord.updateMany).toHaveBeenCalledWith({