sozsoft-platform/api/modules/Sozsoft.Sender/SozsoftSenderModule.cs
2026-08-28 15:03:36 +03:00

56 lines
2.2 KiB
C#

using Microsoft.Extensions.DependencyInjection;
using Sozsoft.Sender.Localization;
using Sozsoft.Sender.Mail;
using Sozsoft.Sender.Mail.AmazonSes;
using Sozsoft.Sender.Rocket;
using Sozsoft.Sender.Sms;
using Sozsoft.Sender.Sms.PostaGuvercini;
using Sozsoft.Sender.Telegram;
using Sozsoft.Sender.WhatsApp;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.Emailing;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.Sms;
namespace Sozsoft.Sender;
[DependsOn(
typeof(AbpEmailingModule),
typeof(AbpSmsModule))]
public class ErpSenderModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpLocalizationOptions>(options =>
{
options.Resources.Add<ErpSenderResource>("en");
});
Configure<AbpBackgroundJobOptions>(options =>
{
options.AddJob<ErpBackgroundEmailSendingJob>();
});
//Register a factory method that resolves from IServiceProvider
context.Services.AddScoped<ISozsoftEmailSender>(sp => sp.GetRequiredService<AmazonSesEmailSender>());
context.Services.AddScoped<ISozsoftSmsSender>(sp => sp.GetRequiredService<PostaGuverciniSmsSender>());
context.Services.AddScoped<ISozsoftRocketSender>(sp => sp.GetRequiredService<RocketSender>());
context.Services.AddScoped<ISozsoftWhatsAppSender>(sp => sp.GetRequiredService<SozsoftWhatsAppSender>());
context.Services.AddScoped<ISozsoftTelegramSender>(sp => sp.GetRequiredService<SozsoftTelegramSender>());
context.Services.AddHttpClient<PostaGuverciniHttpClient>();
context.Services.AddScoped<IPostaGuverciniHttpClient>(sp => sp.GetRequiredService<PostaGuverciniHttpClient>());
context.Services.AddHttpClient<RocketHttpClient>();
context.Services.AddScoped<IRocketHttpClient>(sp => sp.GetRequiredService<RocketHttpClient>());
context.Services.AddHttpClient<WhatsAppHttpClient>();
context.Services.AddScoped<IWhatsAppHttpClient>(sp => sp.GetRequiredService<WhatsAppHttpClient>());
context.Services.AddHttpClient<TelegramHttpClient>();
context.Services.AddScoped<ITelegramHttpClient>(sp => sp.GetRequiredService<TelegramHttpClient>());
}
}