erp-platform/api/modules/Erp.Sender/ErpSenderModule.cs
2025-11-11 22:49:52 +03:00

51 lines
1.9 KiB
C#

using Erp.Sender.Localization;
using Erp.Sender.Mail;
using Erp.Sender.Mail.AmazonSes;
using Erp.Sender.Rocket;
using Erp.Sender.Sms;
using Erp.Sender.Sms.PostaGuvercini;
using Erp.Sender.WhatsApp;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.Emailing;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.Sms;
namespace Erp.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<IErpEmailSender>(sp => sp.GetRequiredService<AmazonSesEmailSender>());
context.Services.AddScoped<IErpSmsSender>(sp => sp.GetRequiredService<PostaGuverciniSmsSender>());
context.Services.AddScoped<IErpRocketSender>(sp => sp.GetRequiredService<RocketSender>());
context.Services.AddScoped<IErpWhatsAppSender>(sp => sp.GetRequiredService<ErpWhatsAppSender>());
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>());
}
}