Files
meezi/src/Meezi.Admin.API/Models/IntegrationDtos.cs
T
soroush.asadi 00649d0248
CI/CD / CI · API (dotnet build + test) (push) Successful in 40s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 30s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m8s
CI/CD / CI · Admin Web (tsc) (push) Successful in 37s
CI/CD / CI · Website (tsc) (push) Successful in 45s
CI/CD / CI · Koja (tsc) (push) Successful in 50s
CI/CD / Deploy · all services (push) Successful in 5m16s
feat(sms): bring-your-own-provider — cafés use their own SMS account
The platform no longer sells SMS. Each café saves its OWN Kavenegar API
key + sender line (new Cafes columns + migration) and campaigns are sent
and billed through that account.

Backend:
- GET/PUT /sms/settings (Manager/Owner; key echoed masked, verified
  against the provider before saving)
- campaign + balance use the café's credentials; SMS_NOT_CONFIGURED
  error when missing; plan-tier SMS gating removed everywhere
  (PlanLimitChecker, SmsMarketingService, billing status)
- platform Kavenegar config stays ONLY for login OTPs (env/DB)
- design-time DbContext factory so `dotnet ef migrations add` works
  without booting the host

Dashboard:
- SMS screen: provider-settings card, not-configured callout, campaign
  form disabled until configured; quota bar removed (usage stays as info)
- subscription screen + plan comparison no longer show SMS limits

Admin panel:
- Kavenegar/SMS section removed from integrations (request field now
  optional; stored OTP config untouched)
- SMS limit field removed from the plan editor
- nav label "درگاه و پیامک" → "درگاه پرداخت و AI"

fa/en/ar translations. 86 tests pass; all tsc clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 09:23:50 +03:30

115 lines
3.0 KiB
C#

namespace Meezi.Admin.API.Models;
public record GatewayCredentialsDto(
string? Username,
string? Password,
string? BranchCode,
string? TerminalCode,
string? ClientId,
string? ClientSecret,
string? BaseUrl,
bool HasStoredPassword,
bool HasStoredClientSecret);
public record PaymentGatewayConfigDto(
string Id,
string DisplayNameFa,
bool IsEnabled,
bool IsActive,
string? MerchantId,
string? ApiKey,
bool Sandbox,
bool HasStoredSecret,
GatewayCredentialsDto? Credentials = null);
public record KavenegarConfigDto(
bool IsEnabled,
string? ApiKey,
string OtpTemplate,
string SenderNumber,
bool HasStoredApiKey);
public record OpenAiIntegrationConfigDto(
bool IsEnabled,
string? ApiKey,
string Model,
bool CoffeeAdvisorEnabled,
bool HasStoredApiKey);
public record MeshyIntegrationConfigDto(
bool IsEnabled,
string? ApiKey,
bool Menu3dEnabled,
bool HasStoredApiKey);
public record AiIntegrationsConfigDto(
OpenAiIntegrationConfigDto OpenAi,
MeshyIntegrationConfigDto Meshy);
public record PlatformIntegrationsDto(
string ActivePaymentGateway,
IReadOnlyList<PaymentGatewayConfigDto> PaymentGateways,
KavenegarConfigDto Kavenegar,
AiIntegrationsConfigDto Ai);
public record UpdatePlatformIntegrationsRequest(
string ActivePaymentGateway,
IReadOnlyList<UpdatePaymentGatewayRequest> PaymentGateways,
// Optional: the admin UI no longer manages SMS (marketing SMS is
// bring-your-own-provider per café). When null, the stored platform
// Kavenegar config — still used for login OTPs — is left untouched.
UpdateKavenegarRequest? Kavenegar = null,
UpdateAiIntegrationsRequest? Ai = null);
public record UpdateOpenAiIntegrationRequest(
bool IsEnabled,
string? ApiKey,
string Model,
bool CoffeeAdvisorEnabled);
public record UpdateMeshyIntegrationRequest(
bool IsEnabled,
string? ApiKey,
bool Menu3dEnabled);
public record UpdateAiIntegrationsRequest(
UpdateOpenAiIntegrationRequest OpenAi,
UpdateMeshyIntegrationRequest Meshy);
public record UpdatePaymentGatewayCredentialsRequest(
string? Username,
string? Password,
string? BranchCode,
string? TerminalCode,
string? ClientId,
string? ClientSecret,
string? BaseUrl);
public record UpdatePaymentGatewayRequest(
string Id,
bool IsEnabled,
string? MerchantId,
string? ApiKey,
bool Sandbox,
UpdatePaymentGatewayCredentialsRequest? Credentials = null);
public record UpdateKavenegarRequest(
bool IsEnabled,
string? ApiKey,
string OtpTemplate,
string SenderNumber);
public record AdminNotificationRowDto(
string Id,
string CafeId,
string CafeName,
string Type,
string Title,
string? Body,
bool IsRead,
DateTime CreatedAt);
public record BroadcastNotificationRequest(string Title, string Body);
public record BroadcastNotificationResult(int CafeCount, int NotificationCount);