erp-platform/api/modules/Erp.Sender/ErpSenderModule.cs

52 lines
1.9 KiB
C#
Raw Permalink Normal View History

2025-11-11 19:49:52 +00:00
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;
2025-05-06 06:45:49 +00:00
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.Emailing;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.Sms;
2025-11-11 19:49:52 +00:00
namespace Erp.Sender;
2025-05-06 06:45:49 +00:00
[DependsOn(
typeof(AbpEmailingModule),
typeof(AbpSmsModule))]
2025-11-11 19:49:52 +00:00
public class ErpSenderModule : AbpModule
2025-05-06 06:45:49 +00:00
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpLocalizationOptions>(options =>
{
2025-11-11 19:49:52 +00:00
options.Resources.Add<ErpSenderResource>("en");
2025-05-06 06:45:49 +00:00
});
Configure<AbpBackgroundJobOptions>(options =>
{
2025-11-11 19:49:52 +00:00
options.AddJob<ErpBackgroundEmailSendingJob>();
2025-05-06 06:45:49 +00:00
});
//Register a factory method that resolves from IServiceProvider
2025-11-11 19:49:52 +00:00
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>());
2025-05-06 06:45:49 +00:00
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>());
}
}
2025-11-11 19:49:52 +00:00