feat: register official MeliPayamak patterns 580259/580260 for lead advisor flow and enforce TLS port 465 for Stalwart SMTP
Deploy Canina / deploy (push) Successful in 3m11s
Deploy Canina / deploy (push) Successful in 3m11s
This commit is contained in:
1 parent
1c4f7e9d10
commit
6c1a11a8e2
4 files changed
+24
-9
No files matched your search
@@ -339,11 +339,17 @@ export class AdvisorsService {
|
||||
if (advisor) {
|
||||
const productName = product ? product.nameFa : 'مشاوره عمومی';
|
||||
const advisorMsg = `مشاور گرامی، درخواست تماس جدیدی از ${dto.firstName} ${dto.lastName} (${cleanPhone}) برای «${productName}» ثبت شد. لطفاً در اسرع وقت تماس حاصل فرمایید.`;
|
||||
const clientName = `${dto.firstName} ${dto.lastName}`.trim();
|
||||
|
||||
await this.queueService.enqueue({
|
||||
channel: 'SMS',
|
||||
recipient: advisor.phone,
|
||||
event: 'NEW_LEAD',
|
||||
content: advisorMsg,
|
||||
payload: {
|
||||
patternId: 580260,
|
||||
args: [clientName, cleanPhone, productName],
|
||||
},
|
||||
idempotencyKey: `lead_advisor_${lead.id}`,
|
||||
});
|
||||
}
|
||||
@@ -355,6 +361,10 @@ export class AdvisorsService {
|
||||
recipient: cleanPhone,
|
||||
event: 'LEAD_CONFIRMATION',
|
||||
content: clientMsg,
|
||||
payload: {
|
||||
patternId: 580259,
|
||||
args: [dto.firstName.trim()],
|
||||
},
|
||||
idempotencyKey: `lead_client_${lead.id}`,
|
||||
});
|
||||
|
||||
|
||||
@@ -67,11 +67,14 @@ export class EmailService {
|
||||
*/
|
||||
async saveConfig(dto: Partial<SmtpConfig>): Promise<SmtpConfig> {
|
||||
const current = await this.getConfig();
|
||||
const port = Number(dto.port ?? current.port);
|
||||
const secure = dto.secure !== undefined ? Boolean(dto.secure) : (port === 465);
|
||||
|
||||
const updated: SmtpConfig = {
|
||||
...current,
|
||||
...dto,
|
||||
port: Number(dto.port ?? current.port),
|
||||
secure: dto.secure ?? (Number(dto.port ?? current.port) === 465),
|
||||
port,
|
||||
secure,
|
||||
};
|
||||
|
||||
const existing = await this.prisma.setting.findFirst({ where: { category: 'email' } });
|
||||
@@ -104,7 +107,8 @@ export class EmailService {
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const isExplicitTls = config.secure || config.port === 465;
|
||||
// If port is 465 or secure=true, connect via direct TLS
|
||||
const isExplicitTls = Boolean(config.secure) || Number(config.port) === 465;
|
||||
let buffer = '';
|
||||
let stage = 0; // 0=greet, 1=ehlo, 2=auth_login, 3=user, 4=pass, 5=quit
|
||||
let banner = '';
|
||||
@@ -225,7 +229,8 @@ export class EmailService {
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const isExplicitTls = config.secure || config.port === 465;
|
||||
// If port is 465 or secure=true, connect via direct TLS
|
||||
const isExplicitTls = Boolean(config.secure) || Number(config.port) === 465;
|
||||
let buffer = '';
|
||||
let stage = 0; // 0=greet, 1=ehlo, 2=auth_login, 3=user, 4=pass, 5=mail_from, 6=rcpt_to, 7=data_cmd, 8=data_body, 9=quit
|
||||
const messageId = `<${Date.now()}.${Math.random().toString(36).substring(2)}@${config.host}>`;
|
||||
|
||||
@@ -14,7 +14,7 @@ export class UpdateEmailConfigDto {
|
||||
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
secure?: boolean;
|
||||
secure?: boolean = true;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@@ -52,7 +52,7 @@ export class TestSmtpDto {
|
||||
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
secure?: boolean;
|
||||
secure?: boolean = true;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -65,9 +65,9 @@ export default function NotificationsSettingsPage() {
|
||||
// Email Config State
|
||||
const [emailConfig, setEmailConfig] = useState<EmailConfig>({
|
||||
enabled: true,
|
||||
host: 'mail.canina.ir',
|
||||
port: 587,
|
||||
secure: false,
|
||||
host: 'mail.parsaaghayi.ir',
|
||||
port: 465,
|
||||
secure: true,
|
||||
user: '',
|
||||
password: '',
|
||||
fromName: 'کنینا ایران',
|
||||
|
||||
Reference in new issue
Block a user