fix: accept partially reported CMPP signatures
This commit is contained in:
@@ -596,6 +596,55 @@ describe('SendChainService', () => {
|
||||
where: { id: 'task-1' },
|
||||
data: expect.objectContaining({ status: 'pending_review', riskTaskId: 'review-task-1', auditStatus: 'pending' }),
|
||||
});
|
||||
expect(prisma.smsSignature.findFirst).toHaveBeenCalledWith({
|
||||
where: {
|
||||
applicationId: 'app-1',
|
||||
name: '【签名】',
|
||||
auditStatus: 'approved',
|
||||
},
|
||||
orderBy: { updatedAt: 'desc' },
|
||||
});
|
||||
expect(prisma.smsReceiptRecord.create).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('accepts an approved bracketed signature when only part of its channels are reported', async () => {
|
||||
const { service, prisma, riskReview } = createService();
|
||||
prisma.smsApplication.findFirst.mockResolvedValue({
|
||||
id: 'app-1',
|
||||
tenantId: 'tenant-1',
|
||||
cmppAccount: '100001',
|
||||
status: 'active',
|
||||
interfaceEnabled: true,
|
||||
templateMismatchMode: 'manual_review',
|
||||
customerUnitPrice: 3,
|
||||
queuePriority: 'normal',
|
||||
ipAllowlist: [{ ipCidr: '127.0.0.1/32' }],
|
||||
tenant: { id: 'tenant-1', status: 'active', certificationStatus: 'approved' },
|
||||
});
|
||||
prisma.smsTemplate.findFirst.mockResolvedValue(null);
|
||||
prisma.smsSignature.findFirst.mockResolvedValue({
|
||||
id: 'sig-1',
|
||||
name: '【航天信息信诺网】',
|
||||
auditStatus: 'approved',
|
||||
reportStatus: 'reporting',
|
||||
});
|
||||
|
||||
await expect(service.submitInboundMessage({
|
||||
account: '100001',
|
||||
phoneNumber: '18821203795',
|
||||
content: '【航天信息信诺网】您本次操作的验证码是171102,有效时10分钟。',
|
||||
remoteIp: '127.0.0.1',
|
||||
})).resolves.toEqual(expect.objectContaining({ accepted: true, messageRecordId: 'record-1' }));
|
||||
|
||||
expect(prisma.smsSignature.findFirst).toHaveBeenCalledWith({
|
||||
where: {
|
||||
applicationId: 'app-1',
|
||||
name: '【航天信息信诺网】',
|
||||
auditStatus: 'approved',
|
||||
},
|
||||
orderBy: { updatedAt: 'desc' },
|
||||
});
|
||||
expect(riskReview.aggregateTemplateMismatch).toHaveBeenCalledWith(expect.objectContaining({ signatureId: 'sig-1' }));
|
||||
expect(prisma.smsReceiptRecord.create).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user