Fully implement Kavenegar SMS support
Core changes: - ISmsService: add SendBulkAsync (batches of 200) + GetAccountInfoAsync - KavenegarSmsService: POST requests, sender number config, bulk send via comma-separated receptors, account balance, full error code mapping (HTTP 400-432), enabled-flag check before any send - SmsMarketingService: replaced per-recipient loop with SendBulkAsync - SmsController: new GET /sms/balance endpoint returns Kavenegar credit - SmsDtos: SmsBalanceDto - IntegrationDtos + PlatformIntegrationService: SenderNumber field - appsettings.json + docker-compose: Kavenegar__SenderNumber = 90005671 Dashboard: - sms-screen: char counter, SMS parts indicator (Persian 70/67 chars, Latin 160/153), account balance card, sender line display, result banner Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,23 @@
|
||||
namespace Meezi.Core.Interfaces;
|
||||
|
||||
public record KavenegarAccountInfo(long RemainCredit, string AccountType);
|
||||
|
||||
public record BulkSendResult(int SentCount, int FailedCount);
|
||||
|
||||
public interface ISmsService
|
||||
{
|
||||
/// <summary>Send a one-time password via Kavenegar Verify/Lookup template.</summary>
|
||||
Task SendOtpAsync(string phone, string otp, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>Send a plain-text message to a single recipient.</summary>
|
||||
Task SendMessageAsync(string phone, string message, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Send the same message to many recipients in batches of up to 200.
|
||||
/// Never throws — failures per batch are counted and returned.
|
||||
/// </summary>
|
||||
Task<BulkSendResult> SendBulkAsync(IReadOnlyList<string> phones, string message, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>Returns credit balance from the Kavenegar account, or null if not configured.</summary>
|
||||
Task<KavenegarAccountInfo?> GetAccountInfoAsync(CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user