feat: filter SMS routes by channel sensitive words
This commit is contained in:
@@ -466,7 +466,8 @@ export class SendDownstreamDeliveryService {
|
||||
const existing = await this.prisma.smsReceiptRecord.findFirst({
|
||||
where: { messageRecordId: message.id, gatewayMessageId: `PLATFORM:${message.messageId}` },
|
||||
});
|
||||
if (existing && !errorCode.startsWith('DRN')) return existing;
|
||||
const recoverableRejection = errorCode.startsWith('DRN') || errorCode === 'CSW';
|
||||
if (existing && !recoverableRejection) return existing;
|
||||
const deliveredAt = new Date();
|
||||
await this.prisma.smsMessageRecord.update({
|
||||
where: { id: message.id },
|
||||
@@ -501,12 +502,12 @@ export class SendDownstreamDeliveryService {
|
||||
};
|
||||
const receipt =
|
||||
existing ??
|
||||
(errorCode.startsWith('DRN')
|
||||
(recoverableRejection
|
||||
? await this.prisma.smsReceiptRecord.upsert({ where: { receiptKey }, update: {}, create: receiptData })
|
||||
: await this.prisma.smsReceiptRecord.create({ data: receiptData }));
|
||||
await queueFinalReceiptDeliveries(this.prisma, (request) => this.facade.queueAndTryDownstreamDelivery(request), {
|
||||
message,
|
||||
propagateHttpQueueError: errorCode.startsWith('DRN'),
|
||||
propagateHttpQueueError: recoverableRejection,
|
||||
allowBusinessRejectionCmppDelivery: errorCode === 'ACCOUNT' || errorCode === 'INTERFACE',
|
||||
payload: {
|
||||
messageId: message.messageId,
|
||||
@@ -520,6 +521,11 @@ export class SendDownstreamDeliveryService {
|
||||
},
|
||||
});
|
||||
if (message.batchTaskId) await this.facade.refreshTaskProgress(message.batchTaskId);
|
||||
if (errorCode === 'CSW')
|
||||
await this.prisma.smsMessageRecord.update({
|
||||
where: { id: message.id },
|
||||
data: { channelWordFinalizationPending: false },
|
||||
});
|
||||
if (errorCode.startsWith('DRN'))
|
||||
await this.prisma.smsMessageRecord.update({ where: { id: message.id }, data: { drainageReceiptPending: false } });
|
||||
return receipt;
|
||||
|
||||
Reference in New Issue
Block a user