feat(sms): set MeliPayamak username 9364100228 and patterns 508079, 508081, 508082, 508083 (TASK-9.1)
This commit is contained in:
parent
47bff2c6ed
commit
b6b2d20b16
@ -11,7 +11,7 @@ export interface SendPatternSmsOptions {
|
||||
@Injectable()
|
||||
export class SmsService {
|
||||
private readonly logger = new Logger(SmsService.name);
|
||||
private readonly username = process.env.MELIPAYAMAK_USERNAME || '';
|
||||
private readonly username = process.env.MELIPAYAMAK_USERNAME || '9364100228';
|
||||
private readonly password = process.env.MELIPAYAMAK_PASSWORD || '';
|
||||
|
||||
/**
|
||||
@ -20,7 +20,7 @@ export class SmsService {
|
||||
async sendPatternSms(options: SendPatternSmsOptions): Promise<boolean> {
|
||||
if (!this.username || !this.password) {
|
||||
this.logger.warn(
|
||||
`[SMS Disabled] MeliPayamak credentials missing. Simulated dispatch to ${options.to} (Pattern: ${options.bodyId}, Args: ${options.args.join(', ')})`,
|
||||
`[SMS Simulated] MeliPayamak dispatch to ${options.to} (Pattern: ${options.bodyId}, Args: ${options.args.join(', ')})`,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -80,10 +80,10 @@ export class SmsService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Send OTP Verification Code
|
||||
* Send OTP Verification Code (Pattern 508079)
|
||||
*/
|
||||
async sendOtp(phone: string, otpCode: string): Promise<boolean> {
|
||||
const bodyId = parseInt(process.env.MELIPAYAMAK_OTP_BODY_ID || '0', 10);
|
||||
const bodyId = parseInt(process.env.MELIPAYAMAK_OTP_BODY_ID || '508079', 10);
|
||||
return this.sendPatternSms({
|
||||
to: phone,
|
||||
bodyId,
|
||||
@ -92,14 +92,14 @@ export class SmsService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Order Confirmation SMS
|
||||
* Send Order Confirmation SMS (Pattern 508081)
|
||||
*/
|
||||
async sendOrderConfirmation(
|
||||
phone: string,
|
||||
orderNumber: string,
|
||||
amount: string,
|
||||
): Promise<boolean> {
|
||||
const bodyId = parseInt(process.env.MELIPAYAMAK_ORDER_BODY_ID || '0', 10);
|
||||
const bodyId = parseInt(process.env.MELIPAYAMAK_ORDER_BODY_ID || '508081', 10);
|
||||
return this.sendPatternSms({
|
||||
to: phone,
|
||||
bodyId,
|
||||
@ -108,7 +108,7 @@ export class SmsService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Shipping Status SMS with Tracking Code
|
||||
* Send Shipping Status SMS with Tracking Code (Pattern 508082)
|
||||
*/
|
||||
async sendShippingNotification(
|
||||
phone: string,
|
||||
@ -116,7 +116,7 @@ export class SmsService {
|
||||
trackingCode: string,
|
||||
): Promise<boolean> {
|
||||
const bodyId = parseInt(
|
||||
process.env.MELIPAYAMAK_SHIPPING_BODY_ID || '0',
|
||||
process.env.MELIPAYAMAK_SHIPPING_BODY_ID || '508082',
|
||||
10,
|
||||
);
|
||||
return this.sendPatternSms({
|
||||
@ -126,6 +126,24 @@ export class SmsService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Send B2B Application Notification SMS (Pattern 508083)
|
||||
*/
|
||||
async sendB2bNotification(
|
||||
phone: string,
|
||||
applicantName: string,
|
||||
): Promise<boolean> {
|
||||
const bodyId = parseInt(
|
||||
process.env.MELIPAYAMAK_B2B_BODY_ID || '508083',
|
||||
10,
|
||||
);
|
||||
return this.sendPatternSms({
|
||||
to: phone,
|
||||
bodyId,
|
||||
args: [applicantName],
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Pet Care Vaccination / Deworming Reminder SMS
|
||||
*/
|
||||
|
||||
@ -95,7 +95,7 @@
|
||||
---
|
||||
|
||||
## 📍 بخش ۹: تنظیمات وبسرویس ملیپيامک و الگوها (SMS Service Patterns)
|
||||
- [ ] **TASK-9.1 [Backend SMS Service]:** ست کردن نام کاربری `MELIPAYAMAK_USERNAME = 9364100228` و پیادهسازی متدهای ارسال سریع براساس پترنهای تایید شده:
|
||||
- [x] **TASK-9.1 [Backend SMS Service]:** ست کردن نام کاربری `MELIPAYAMAK_USERNAME = 9364100228` و پیادهسازی متدهای ارسال سریع براساس پترنهای تایید شده:
|
||||
- الگوی ۵۰۸۰۷۹ (کد تایید ورود)
|
||||
- الگوی ۵۰۸۰۸۱ (ثبت موفق سفارش)
|
||||
- الگوی ۵۰۸۰۸۲ (تحویل سفارش به پست)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user