diff --git a/src/CMSMicroservice.Application/ClubMembershipCQ/Commands/ActivateClubMembership/ActivateClubMembershipCommandHandler.cs b/src/CMSMicroservice.Application/ClubMembershipCQ/Commands/ActivateClubMembership/ActivateClubMembershipCommandHandler.cs index b7842e1..1d941c1 100644 --- a/src/CMSMicroservice.Application/ClubMembershipCQ/Commands/ActivateClubMembership/ActivateClubMembershipCommandHandler.cs +++ b/src/CMSMicroservice.Application/ClubMembershipCQ/Commands/ActivateClubMembership/ActivateClubMembershipCommandHandler.cs @@ -150,7 +150,7 @@ public class ActivateClubMembershipCommandHandler : IRequestHandler public long UserId { get; set; } /// - /// مبلغ تراکنش (ریال) + /// مبلغ تراکنش (تومان) /// public long Amount { get; set; } diff --git a/src/CMSMicroservice.Application/ManualPaymentCQ/Commands/ProcessManualMembershipPayment/ProcessManualMembershipPaymentCommand.cs b/src/CMSMicroservice.Application/ManualPaymentCQ/Commands/ProcessManualMembershipPayment/ProcessManualMembershipPaymentCommand.cs index 4a337b7..b9adfe4 100644 --- a/src/CMSMicroservice.Application/ManualPaymentCQ/Commands/ProcessManualMembershipPayment/ProcessManualMembershipPaymentCommand.cs +++ b/src/CMSMicroservice.Application/ManualPaymentCQ/Commands/ProcessManualMembershipPayment/ProcessManualMembershipPaymentCommand.cs @@ -8,7 +8,7 @@ public record ProcessManualMembershipPaymentCommand : IRequest - /// مبلغ پرداختی (ریال) + /// مبلغ پرداختی (تومان) /// public long Amount { get; init; } diff --git a/src/CMSMicroservice.Application/UserWalletCQ/Queries/GetCustomerWithdrawalSettings/GetCustomerWithdrawalSettingsResponseDto.cs b/src/CMSMicroservice.Application/UserWalletCQ/Queries/GetCustomerWithdrawalSettings/GetCustomerWithdrawalSettingsResponseDto.cs index 98695f2..8a5b8d8 100644 --- a/src/CMSMicroservice.Application/UserWalletCQ/Queries/GetCustomerWithdrawalSettings/GetCustomerWithdrawalSettingsResponseDto.cs +++ b/src/CMSMicroservice.Application/UserWalletCQ/Queries/GetCustomerWithdrawalSettings/GetCustomerWithdrawalSettingsResponseDto.cs @@ -3,7 +3,7 @@ namespace CMSMicroservice.Application.UserWalletCQ.Queries.GetCustomerWithdrawal public class GetCustomerWithdrawalSettingsResponseDto { /// - /// حداقل مبلغ برداشت (ریال) + /// حداقل مبلغ برداشت (تومان) /// public long MinWithdrawalAmount { get; set; } } diff --git a/src/CMSMicroservice.Application/WalletCQ/Commands/ChargeDiscountWallet/ChargeDiscountWalletCommand.cs b/src/CMSMicroservice.Application/WalletCQ/Commands/ChargeDiscountWallet/ChargeDiscountWalletCommand.cs index c2f4a80..6650dc0 100644 --- a/src/CMSMicroservice.Application/WalletCQ/Commands/ChargeDiscountWallet/ChargeDiscountWalletCommand.cs +++ b/src/CMSMicroservice.Application/WalletCQ/Commands/ChargeDiscountWallet/ChargeDiscountWalletCommand.cs @@ -15,7 +15,7 @@ public class ChargeDiscountWalletCommand : IRequest public long UserId { get; set; } /// - /// مبلغ مورد نظر برای شارژ (ریال) + /// مبلغ مورد نظر برای شارژ (تومان) /// public long Amount { get; set; } } diff --git a/src/CMSMicroservice.Application/WalletCQ/Commands/ChargeMagicWallet/ChargeMagicWalletCommand.cs b/src/CMSMicroservice.Application/WalletCQ/Commands/ChargeMagicWallet/ChargeMagicWalletCommand.cs index 3e05022..411ecfb 100644 --- a/src/CMSMicroservice.Application/WalletCQ/Commands/ChargeMagicWallet/ChargeMagicWalletCommand.cs +++ b/src/CMSMicroservice.Application/WalletCQ/Commands/ChargeMagicWallet/ChargeMagicWalletCommand.cs @@ -15,7 +15,7 @@ public class ChargeMagicWalletCommand : IRequest public long UserId { get; set; } /// - /// مبلغ واریزی واقعی (ریال) — اعتبار = مبلغ × 2.5 + /// مبلغ واریزی واقعی (تومان) — اعتبار = مبلغ × 2.5 /// public long Amount { get; set; } } diff --git a/src/CMSMicroservice.Application/WalletCQ/Commands/ChargeMagicWallet/ChargeMagicWalletCommandHandler.cs b/src/CMSMicroservice.Application/WalletCQ/Commands/ChargeMagicWallet/ChargeMagicWalletCommandHandler.cs index 1210313..cc8f5d6 100644 --- a/src/CMSMicroservice.Application/WalletCQ/Commands/ChargeMagicWallet/ChargeMagicWalletCommandHandler.cs +++ b/src/CMSMicroservice.Application/WalletCQ/Commands/ChargeMagicWallet/ChargeMagicWalletCommandHandler.cs @@ -109,7 +109,7 @@ public class ChargeMagicWalletCommandHandler remainingDeposit ); throw new BadRequestException( - $"مبلغ واریزی بیش از سقف باقیمانده است. حداکثر مبلغ قابل واریز: {remainingDeposit:N0} ریال" + $"مبلغ واریزی بیش از سقف باقیمانده است. حداکثر مبلغ قابل واریز: {remainingDeposit:N0} تومان" ); } diff --git a/src/CMSMicroservice.Application/WalletCQ/Commands/VerifyMagicWalletCharge/VerifyMagicWalletChargeCommandHandler.cs b/src/CMSMicroservice.Application/WalletCQ/Commands/VerifyMagicWalletCharge/VerifyMagicWalletChargeCommandHandler.cs index 17425b6..c455e4e 100644 --- a/src/CMSMicroservice.Application/WalletCQ/Commands/VerifyMagicWalletCharge/VerifyMagicWalletChargeCommandHandler.cs +++ b/src/CMSMicroservice.Application/WalletCQ/Commands/VerifyMagicWalletCharge/VerifyMagicWalletChargeCommandHandler.cs @@ -57,7 +57,7 @@ public class VerifyMagicWalletChargeCommandHandler var userId = paymentTx.UserId ?? throw new BadRequestException("شناسه کاربر در تراکنش پرداخت یافت نشد"); - var depositAmount = paymentTx.Amount; // مبلغ واقعی واریزی (ریال) + var depositAmount = paymentTx.Amount; // مبلغ واقعی واریزی (تومان) // 2. بررسی وضعیت برگشتی از درگاه if (!string.Equals(request.Status, "OK", StringComparison.OrdinalIgnoreCase)) @@ -74,7 +74,7 @@ public class VerifyMagicWalletChargeCommandHandler throw new BadRequestException("پرداخت توسط کاربر لغو شد"); } - // 3. Verify با درگاه (مبلغ به ریال) + // 3. Verify با درگاه (مبلغ به تومان — تبدیل به ریال در ZarinPalService) var verifyResult = await _paymentGateway.VerifyPaymentAsync( request.Authority, request.Status, diff --git a/src/CMSMicroservice.Domain/Entities/Package.cs b/src/CMSMicroservice.Domain/Entities/Package.cs index 158a150..9bfbe0f 100644 --- a/src/CMSMicroservice.Domain/Entities/Package.cs +++ b/src/CMSMicroservice.Domain/Entities/Package.cs @@ -19,7 +19,7 @@ public class Package : BaseAuditableEntity, IHasHistory /// آدرس تصویر public string ImagePath { get; set; } - /// قیمت پکیج (ریال) + /// قیمت پکیج (تومان) public long Price { get; set; } // === فیلدهای جدید v3 === diff --git a/src/CMSMicroservice.Infrastructure/Services/Monitoring/UserNotificationService.cs b/src/CMSMicroservice.Infrastructure/Services/Monitoring/UserNotificationService.cs index 9d1118b..a85d0ae 100644 --- a/src/CMSMicroservice.Infrastructure/Services/Monitoring/UserNotificationService.cs +++ b/src/CMSMicroservice.Infrastructure/Services/Monitoring/UserNotificationService.cs @@ -78,7 +78,7 @@ public class UserNotificationService : IUserNotificationService var emailSubject = $"واریز کمیسیون هفته {weekNumber}{packageInfo}"; var emailBody = "
" + $"

سلام {userFullName}

" + - $"

کمیسیون هفته {weekNumber} شما{packageInfo} به مبلغ {formattedAmount} ریال به کیف پول شما واریز شد.

" + + $"

کمیسیون هفته {weekNumber} شما{packageInfo} به مبلغ {formattedAmount} تومان به کیف پول شما واریز شد.

" + "

از اعتماد شما سپاسگزاریم.

" + "
" + "

FourSat - سیستم مدیریت باشگاه مشتریان

" + @@ -97,7 +97,7 @@ public class UserNotificationService : IUserNotificationService { await SendSmsAsync( phoneNumber: user.Mobile, - message: $"سلام {userFullName}\nکمیسیون هفته {weekNumber} شما{packageInfo} به مبلغ {formattedAmount} ریال واریز شد.\nFourSat", + message: $"سلام {userFullName}\nکمیسیون هفته {weekNumber} شما{packageInfo} به مبلغ {formattedAmount} تومان واریز شد.\nFourSat", cancellationToken: cancellationToken); } diff --git a/src/CMSMicroservice.Infrastructure/Services/Payment/ZarinPalPaymentService.cs b/src/CMSMicroservice.Infrastructure/Services/Payment/ZarinPalPaymentService.cs index 9b790ee..a0b05ef 100644 --- a/src/CMSMicroservice.Infrastructure/Services/Payment/ZarinPalPaymentService.cs +++ b/src/CMSMicroservice.Infrastructure/Services/Payment/ZarinPalPaymentService.cs @@ -66,8 +66,9 @@ public class ZarinPalPaymentService : IPaymentGatewayService { try { - // مبلغ از caller به ریال می‌رسد — مستقیم ارسال به زرین‌پال - var amountInRials = (long)request.Amount; + // مبلغ از caller به تومان می‌رسد — تبدیل به ریال برای زرین‌پال (×10) + var amountInToman = (long)request.Amount; + var amountInRials = amountInToman * 10; var zarinPalRequest = new ZarinPalPaymentRequest { @@ -85,8 +86,8 @@ public class ZarinPalPaymentService : IPaymentGatewayService var content = new StringContent(jsonContent, Encoding.UTF8, "application/json"); _logger.LogInformation( - "ZarinPal payment request: Amount={AmountRial} Rial ({AmountToman} Toman), User={UserId}, Sandbox={Sandbox}", - amountInRials, amountInRials / 10m, request.UserId, _useSandbox); + "ZarinPal payment request: Amount={AmountToman} Toman ({AmountRial} Rial), User={UserId}, Sandbox={Sandbox}", + amountInToman, amountInRials, request.UserId, _useSandbox); var response = await _httpClient.PostAsync(RequestEndpoint, content, cancellationToken); var responseBody = await response.Content.ReadAsStringAsync(cancellationToken); @@ -167,7 +168,7 @@ public class ZarinPalPaymentService : IPaymentGatewayService /// /// تأیید پرداخت با مبلغ — نسخه اصلی برای زرین‌پال - /// refId = Authority، verificationToken = Status (OK/NOK)، amount = مبلغ به ریال + /// refId = Authority، verificationToken = Status (OK/NOK)، amount = مبلغ به تومان /// public Task VerifyPaymentAsync( string refId, @@ -181,7 +182,7 @@ public class ZarinPalPaymentService : IPaymentGatewayService private async Task VerifyPaymentWithAmountAsync( string refId, string verificationToken, - decimal amountInRials, + decimal amountInToman, CancellationToken cancellationToken) { try @@ -198,18 +199,21 @@ public class ZarinPalPaymentService : IPaymentGatewayService }; } + // تبدیل تومان به ریال برای زرین‌پال (×10) + var amountInRials = (long)(amountInToman * 10); + var verifyRequest = new ZarinPalVerifyRequest { MerchantId = _merchantId, Authority = refId, - Amount = (long)amountInRials + Amount = amountInRials }; var jsonContent = JsonSerializer.Serialize(verifyRequest, JsonOptions); var content = new StringContent(jsonContent, Encoding.UTF8, "application/json"); - _logger.LogInformation("ZarinPal verify request: Authority={Authority}, Amount={Amount} Rial ({AmountToman} Toman)", - refId, (long)amountInRials, amountInRials / 10m); + _logger.LogInformation("ZarinPal verify request: Authority={Authority}, Amount={AmountToman} Toman ({AmountRial} Rial)", + refId, (long)amountInToman, amountInRials); var response = await _httpClient.PostAsync(VerifyEndpoint, content, cancellationToken); var responseBody = await response.Content.ReadAsStringAsync(cancellationToken); @@ -231,7 +235,7 @@ public class ZarinPalPaymentService : IPaymentGatewayService IsSuccess = true, RefId = refId, TrackingCode = result.Data.RefId?.ToString(), - Amount = result.Data.Amount ?? 0, // ریال — بدون تبدیل + Amount = (result.Data.Amount ?? 0) / 10, // تبدیل ریال → تومان CardPan = result.Data.CardPan, CardHash = result.Data.CardHash, VerificationCode = result.Data.Code, diff --git a/src/CMSMicroservice.WebApi/Controllers/PaymentCallbackController.cs b/src/CMSMicroservice.WebApi/Controllers/PaymentCallbackController.cs index d553488..9898a31 100644 --- a/src/CMSMicroservice.WebApi/Controllers/PaymentCallbackController.cs +++ b/src/CMSMicroservice.WebApi/Controllers/PaymentCallbackController.cs @@ -82,11 +82,11 @@ public class PaymentCallbackController : ControllerBase if (string.Equals(status, "OK", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(authority)) { - // Verify با مبلغ از دیتابیس (ریال) + // Verify با مبلغ از دیتابیس (تومان — تبدیل به ریال در ZarinPalService) var verifyResult = await _paymentGateway.VerifyPaymentAsync( authority, status!, - order.GatewayAmountPaid, // مبلغ به ریال + order.GatewayAmountPaid, // مبلغ به تومان cancellationToken); paymentSuccess = verifyResult.IsSuccess; diff --git a/src/CMSMicroservice.WebApi/Services/ConfigurationService.cs b/src/CMSMicroservice.WebApi/Services/ConfigurationService.cs index 05eb8dd..cb8a812 100644 --- a/src/CMSMicroservice.WebApi/Services/ConfigurationService.cs +++ b/src/CMSMicroservice.WebApi/Services/ConfigurationService.cs @@ -223,20 +223,20 @@ public class ConfigurationService : ConfigurationContract.ConfigurationContractB { return key switch { - "Club.ActivationFee" => "هزینه فعال‌سازی عضویت باشگاه (ریال)", - "Club.MembershipGiftValue" => "مبلغ هدیه حق عضویت باشگاه (ریال)", - "Commission.MinWithdrawalAmount" => "حداقل مبلغ برداشت (ریال)", + "Club.ActivationFee" => "هزینه فعال‌سازی عضویت باشگاه (تومان)", + "Club.MembershipGiftValue" => "مبلغ هدیه حق عضویت باشگاه (تومان)", + "Commission.MinWithdrawalAmount" => "حداقل مبلغ برداشت (تومان)", "Commission.MaxWeeklyBalancesPerLeg" => "سقف تعادل هفتگی برای هر دست", "Commission.MaxNetworkLevel" => "حداکثر عمق شبکه برای محاسبه کمیسیون", "Commission.CashWithdrawalEnabled" => "امکان برداشت نقدی", "Commission.CalculationStrategy" => "روش محاسبه کمیسیون", "Network.AllowOrphanNodes" => "اجازه حذف والدین با فرزند", "Network.MaxChildrenPerLeg" => "حداکثر تعداد فرزند مستقیم در هر پا", - "Package.BasePackageAmount" => "مبلغ پکیج پایه (ریال)", - "Package.DayaLoanAmount" => "مبلغ وام دایا (ریال)", + "Package.BasePackageAmount" => "مبلغ پکیج پایه (تومان)", + "Package.DayaLoanAmount" => "مبلغ وام دایا (تومان)", "MagicWallet.Multiplier" => "ضریب شارژ کیف‌پول جادویی", - "MagicWallet.MaxDeposit" => "سقف واریز هر دور جادویی (ریال)", - "MagicWallet.MaxCredit" => "سقف اعتبار هر دور جادویی (ریال)", + "MagicWallet.MaxDeposit" => "سقف واریز هر دور جادویی (تومان)", + "MagicWallet.MaxCredit" => "سقف اعتبار هر دور جادویی (تومان)", "System.MaintenanceMode" => "حالت تعمیر و نگهداری سیستم", "System.EnableAuditLog" => "فعال‌سازی لاگ تغییرات", "Shop.VAT" => "مالیات بر ارزش افزوده",