feat: integrate PYMS payment gateway, add blog/sitepage/image services, local file manager
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m44s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m44s
Payment Gateway: - Add PYMSPaymentService: IPaymentGatewayService via gRPC to PYMS microservice - Add ZarinPalPaymentService: direct ZarinPal integration (backup) - Register 'pyms' payment provider in DI ConfigureServices - Add PYMS proto files (pyms_transaction.proto, pyms_public_messages.proto) - Fix VerifyDiscountWalletCharge: pass 'OK' as status instead of Authority - Update appsettings: PaymentProvider=pyms, sandbox mode, merchant ID Blog System: - Add BlogCategory, BlogPost, BlogPostImage entities and CQRS - Add proto files and gRPC services for blog management - Add Mapster profiles for blog responses Content Management: - Add SitePage entity and CQRS for static pages - Add proto and gRPC service for site pages Image/File Management: - Add LocalFileManager with disk storage + base64 serving + FMS fallback - Add ImagePathResolverInterceptor for gRPC responses - Add ImageResolverService for explicit image resolution - Add UploadsController for public file serving with FMS fallback - Add PaymentCallbackController for discount order payment callbacks Database: - Add blog and content entity migrations - Remove ImagePath MaxLength constraints - Remove old FileManagementService (replaced by LocalFileManager)
This commit is contained in:
@@ -37,7 +37,8 @@ public static class ConfigureServices
|
||||
services.AddScoped<IAlertService, AlertService>();
|
||||
services.AddScoped<IUserNotificationService, UserNotificationService>();
|
||||
services.AddScoped<IKavenegarService, KavenegarService>();
|
||||
services.AddScoped<IFileManagementService, FileManagementService>();
|
||||
// Local file manager — files are saved to wwwroot/uploads/ on CMS disk
|
||||
services.AddSingleton<CMSMicroservice.Application.Common.FileManager.IFileManager, LocalFileManager>();
|
||||
services.AddScoped<IPermissionService, PermissionService>();
|
||||
|
||||
// Daya Loan API Service - قابل تغییر بین Mock و Real
|
||||
@@ -73,19 +74,31 @@ public static class ConfigureServices
|
||||
});
|
||||
}
|
||||
|
||||
// Payment Gateway Service - فقط Daya (درگاه اینترنتی از Gateway میاد نه CMS)
|
||||
var useRealPaymentGateway = configuration.GetValue<bool>("UseRealPaymentGateway", false);
|
||||
// Payment Gateway Service - Multi-Provider Architecture
|
||||
// پشتیبانی از درگاههای مختلف: ZarinPal, Daya, PYMS, Mock
|
||||
var paymentProvider = configuration.GetValue<string>("PaymentProvider", "Mock")?.ToLowerInvariant();
|
||||
|
||||
if (useRealPaymentGateway)
|
||||
switch (paymentProvider)
|
||||
{
|
||||
// فقط Daya برای پرداخت به کاربران (Payout)
|
||||
services.AddHttpClient<IPaymentGatewayService, DayaPaymentService>()
|
||||
.SetHandlerLifetime(TimeSpan.FromMinutes(5));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mock برای Development و Testing
|
||||
services.AddScoped<IPaymentGatewayService, MockPaymentGatewayService>();
|
||||
case "zarinpal":
|
||||
services.AddHttpClient<IPaymentGatewayService, ZarinPalPaymentService>()
|
||||
.SetHandlerLifetime(TimeSpan.FromMinutes(5));
|
||||
break;
|
||||
|
||||
case "daya":
|
||||
services.AddHttpClient<IPaymentGatewayService, DayaPaymentService>()
|
||||
.SetHandlerLifetime(TimeSpan.FromMinutes(5));
|
||||
break;
|
||||
|
||||
case "pyms":
|
||||
// PYMS (Payment Microservice) — ارتباط gRPC با سرویس پرداخت مستقل
|
||||
services.AddSingleton<IPaymentGatewayService, PYMSPaymentService>();
|
||||
break;
|
||||
|
||||
case "mock":
|
||||
default:
|
||||
services.AddScoped<IPaymentGatewayService, MockPaymentGatewayService>();
|
||||
break;
|
||||
}
|
||||
|
||||
services.AddScoped<IApplicationDbContext>(p => p.GetRequiredService<ApplicationDbContext>());
|
||||
|
||||
Reference in New Issue
Block a user