Substitute org name and balance tokens in outbound SMS so templates no longer leave {از طرف} literal.

EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-14 17:12:31 +03:30
co-authored by Cursor
parent f36fddc23b
commit 717a41e94b
12 changed files with 666 additions and 200 deletions
+6 -1
View File
@@ -1572,11 +1572,16 @@ export class LeadsService {
const mobile = lead.mobile || lead.phone;
if (!mobile) throw new BadRequestException('برای این لید شماره موبایل ثبت نشده است.');
const name = (lead.contactName || lead.title).trim();
const org = await this.prisma.organization.findUnique({
where: { id: actor.organizationId },
select: { name: true },
});
const message = renderSmsText(body, {
name,
phone: mobile,
title: lead.title,
company: lead.contactName ? lead.title : '',
company: lead.trade?.trim() || '',
from: org?.name?.trim() || '',
});
if (!message) throw new BadRequestException('متن پیامک خالی است.');
const result = await this.sms.send({