diff --git a/.gitignore b/.gitignore
index fe8a569..3a644bf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -492,3 +492,8 @@ fabric.properties
.idea/caches/build_file_checksums.ser
/src/.idea
+
+# Environment-specific configuration files with sensitive data
+**/appsettings.Staging.json
+**/appsettings.Production.json
+**/appsettings.*.local.json
diff --git a/src/CMSMicroservice.WebApi/CMSMicroservice.WebApi.csproj b/src/CMSMicroservice.WebApi/CMSMicroservice.WebApi.csproj
index 6399589..de1a330 100644
--- a/src/CMSMicroservice.WebApi/CMSMicroservice.WebApi.csproj
+++ b/src/CMSMicroservice.WebApi/CMSMicroservice.WebApi.csproj
@@ -7,6 +7,10 @@
..\..\..
+
+
+
+
diff --git a/src/CMSMicroservice.WebApi/Program.cs b/src/CMSMicroservice.WebApi/Program.cs
index 37131fe..89ea0ed 100644
--- a/src/CMSMicroservice.WebApi/Program.cs
+++ b/src/CMSMicroservice.WebApi/Program.cs
@@ -3,6 +3,7 @@ using CMSMicroservice.Infrastructure.Data.Seeding;
using CMSMicroservice.Application.Common.Interfaces;
using CMSMicroservice.WebApi.Hubs;
using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.AspNetCore.Hosting;
@@ -208,17 +209,28 @@ using (var scope = app.Services.CreateScope())
{
var recurringJobManager = scope.ServiceProvider.GetRequiredService();
- // Weekly Commission Calculation: Every Sunday at 00:05 (UTC)
- recurringJobManager.AddOrUpdate(
- recurringJobId: "weekly-commission-calculation",
- methodCall: job => job.ExecuteAsync(null, CancellationToken.None),
- cronExpression: "5 0 * * 0", // Sunday at 00:05
- options: new RecurringJobOptions
- {
- TimeZone = TimeZoneInfo.Local
- });
+ // Weekly Commission Calculation: Every Sunday at 00:05 (configurable)
+ var weeklyCommissionEnabled = app.Configuration.GetValue("BackgroundJobs:WeeklyCommissionCalculation:Enabled", true);
+ var weeklyCommissionCron = app.Configuration.GetValue("BackgroundJobs:WeeklyCommissionCalculation:CronExpression", "5 0 * * 0");
- app.Logger.LogInformation("✅ Hangfire recurring job 'weekly-commission-calculation' registered (Cron: 5 0 * * 0 - Sunday 00:05 UTC)");
+ if (weeklyCommissionEnabled)
+ {
+ recurringJobManager.AddOrUpdate(
+ recurringJobId: "weekly-commission-calculation",
+ methodCall: job => job.ExecuteAsync(null, CancellationToken.None),
+ cronExpression: weeklyCommissionCron,
+ options: new RecurringJobOptions
+ {
+ TimeZone = TimeZoneInfo.Local
+ });
+
+ app.Logger.LogInformation("✅ Hangfire recurring job 'weekly-commission-calculation' registered (Cron: {Cron})", weeklyCommissionCron);
+ }
+ else
+ {
+ recurringJobManager.RemoveIfExists("weekly-commission-calculation");
+ app.Logger.LogInformation("⚠️ Hangfire recurring job 'weekly-commission-calculation' is DISABLED in configuration");
+ }
// Daya Loan Check: Every 15 minutes
CMSMicroservice.WebApi.Workers.DayaLoanCheckWorker.Schedule(recurringJobManager);
diff --git a/src/CMSMicroservice.WebApi/appsettings.Development.json b/src/CMSMicroservice.WebApi/appsettings.Development.json
index fe20c40..45353d8 100644
--- a/src/CMSMicroservice.WebApi/appsettings.Development.json
+++ b/src/CMSMicroservice.WebApi/appsettings.Development.json
@@ -1,10 +1,78 @@
{
- "Logging": {
- "LogLevel": {
- "Default": "Debug",
- "System": "Information",
- "Grpc": "Information",
- "Microsoft": "Information"
+ "UseRealPaymentGateway": false,
+ "JwtSecurityKey": "TvlZVx5TJaHs8e9HgUdGzhGP2CIidoI444nAj+8+g7c=",
+ "JwtIssuer": "https://localhost",
+ "JwtAudience": "https://localhost",
+ "JwtExpiryInDays": 5,
+ "ConnectionStrings": {
+ "DefaultConnection": "Data Source=194.5.195.53,31433; Initial Catalog=Foursat;User ID=sa;Password=87zH26nbqT;Connection Timeout=300000;MultipleActiveResultSets=True;Encrypt=False",
+ "providerName": "System.Data.SqlClient"
+ },
+ "Otp": {
+ "Secret": "K2w8k1h1mH2Qz1kqWk0c8kQ2Pq8q9H1eE2nqN1qQ8x7M="
+ },
+ "Monitoring": {
+ "SentryEnabled": false,
+ "SentryDsn": "",
+ "SlackEnabled": false,
+ "SlackWebhookUrl": "",
+ "EmailAlertsEnabled": false,
+ "AdminEmails": [
+ "admin@example.com"
+ ],
+ "SmsNotificationsEnabled": false,
+ "SmsApiKey": "",
+ "SmsGatewayUrl": ""
+ },
+ "Email": {
+ "Enabled": true,
+ "SmtpHost": "smtp.gmail.com",
+ "SmtpPort": 587,
+ "SmtpUsername": "your-email@gmail.com",
+ "SmtpPassword": "your-app-password",
+ "FromEmail": "noreply@foursat.com",
+ "FromName": "FourSat CMS",
+ "EnableSsl": true
+ },
+ "Sms": {
+ "Enabled": true,
+ "Provider": "Kavenegar",
+ "KavenegarApiKey": "497263626F32626A48685A6137524C4F78575A766E4C74694A556B79317648424964655030682B554545413D",
+ "Sender": "1000001110100"
+ },
+ "DayaPayment": {
+ "BaseUrl": "https://api.daya.ir",
+ "ApiKey": "YOUR_DAYA_API_KEY"
+ },
+ "DayaApi": {
+ "UseMock": false,
+ "BaseAddress": "https://Dayadiamond.ir",
+ "MerchantPermissionKey": "56146364$04sXjethI5WxhItR1Q9xnmFdJzl2BB8Bclsq8dAy7YVSZp3vtt-wP7ivrcCvmKLq",
+ "CacheDurationMinutes": 20
+ },
+ "Chatika": {
+ "Enabled": true,
+ "BaseUrl": "https://api.chatika.ir",
+ "ApiKey": "tIukvL8dnV4cB3yVWcCD9Xyfbj8rBxm5wPt2mLyJCgTsBBoMTWjt6mFEqQwpw-er"
+ },
+ "BackgroundJobs": {
+ "WeeklyCommissionCalculation": {
+ "Enabled": true,
+ "CronExpression": "5 0 * * 0"
}
+ },
+ "AllowedHosts": "*",
+ "Kestrel": {
+ "EndpointDefaults": {
+ "Protocols": "Http2"
+ }
+ },
+ "Authentication": {
+ "Authority": "https://ids.domain.com/",
+ "Audience": "domain_api"
+ },
+ "Seq": {
+ "ServerUrl": "https://seq.afrino.co",
+ "ApiKey": "oxpvpUzU1pZxMS4s3Fqq"
}
}
diff --git a/src/CMSMicroservice.WebApi/appsettings.json b/src/CMSMicroservice.WebApi/appsettings.json
index 5ff993e..3f95d04 100644
--- a/src/CMSMicroservice.WebApi/appsettings.json
+++ b/src/CMSMicroservice.WebApi/appsettings.json
@@ -55,6 +55,12 @@
"BaseUrl": "https://api.chatika.ir",
"ApiKey": "tIukvL8dnV4cB3yVWcCD9Xyfbj8rBxm5wPt2mLyJCgTsBBoMTWjt6mFEqQwpw-er"
},
+ "BackgroundJobs": {
+ "WeeklyCommissionCalculation": {
+ "Enabled": true,
+ "CronExpression": "5 0 * * 0"
+ }
+ },
"AllowedHosts": "*",
"Kestrel": {
"EndpointDefaults": {