import { Injectable, Logger } from '@nestjs/common'; import { NabehService } from '../../nabeh/nabeh.service'; import { OtpProvider, OtpSendContext } from '../otp-provider.interface'; /** * مزوّد Nabeh (واتساب) — سوريا والأردن (docs/17 — D5). * غلاف رقيق حول `NabehService` القائم يحوّل الرمي إلى `false` ليعمل ضمن سلسلة * الـfailover. */ @Injectable() export class NabehOtpProvider implements OtpProvider { readonly name = 'nabeh'; private readonly logger = new Logger('NabehOtp'); constructor(private readonly nabeh: NabehService) {} supports(countryPack: string): boolean { return countryPack === 'jo' || countryPack === 'sy'; } async send(phone: string, code: string, _ctx: OtpSendContext): Promise { try { await this.nabeh.sendOtp(phone, code); return true; } catch (e: any) { this.logger.warn(`send failed: ${e?.message}`); return false; } } }