feat: implement Kavenegar SMS service and refactor system configurations to use static constants
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m38s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m38s
This commit is contained in:
+5
-9
@@ -2,6 +2,7 @@ using CMSMicroservice.Application.Common.Exceptions;
|
||||
using CMSMicroservice.Application.Common.Interfaces;
|
||||
using CMSMicroservice.Domain.Entities;
|
||||
using CMSMicroservice.Domain.Enums;
|
||||
using CMSMicroservice.Domain.Common;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -19,11 +20,6 @@ public class InitiateBasePackagePaymentCommandHandler : IRequestHandler<Initiate
|
||||
private readonly IApplicationDbContext _context;
|
||||
private readonly ILogger<InitiateBasePackagePaymentCommandHandler> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ پکیج پایه (56 میلیون تومان)
|
||||
/// </summary>
|
||||
private const long BasePackageAmount = 56_000_000;
|
||||
|
||||
/// <summary>
|
||||
/// شناسه پکیج پایه در دیتابیس
|
||||
/// </summary>
|
||||
@@ -97,7 +93,7 @@ public class InitiateBasePackagePaymentCommandHandler : IRequestHandler<Initiate
|
||||
Message = "سفارش قبلی در انتظار پرداخت یافت شد.",
|
||||
OrderId = pendingOrder.Id,
|
||||
TransactionId = existingTransaction?.Id ?? 0,
|
||||
Amount = BasePackageAmount
|
||||
Amount = SystemConstants.BasePackageAmount
|
||||
};
|
||||
}
|
||||
|
||||
@@ -116,7 +112,7 @@ public class InitiateBasePackagePaymentCommandHandler : IRequestHandler<Initiate
|
||||
// 5. ایجاد Transaction با وضعیت Pending
|
||||
var transaction = new Transaction
|
||||
{
|
||||
Amount = BasePackageAmount,
|
||||
Amount = SystemConstants.BasePackageAmount,
|
||||
Description = $"خرید پکیج پایه ۵۶ میلیونی - کاربر #{user.Id}",
|
||||
PaymentStatus = PaymentStatus.Pending,
|
||||
Type = TransactionType.DepositIpg
|
||||
@@ -135,7 +131,7 @@ public class InitiateBasePackagePaymentCommandHandler : IRequestHandler<Initiate
|
||||
{
|
||||
UserId = user.Id,
|
||||
PackageId = BasePackageId,
|
||||
Amount = BasePackageAmount,
|
||||
Amount = SystemConstants.BasePackageAmount,
|
||||
PaymentStatus = PaymentStatus.Pending,
|
||||
DeliveryStatus = DeliveryStatus.None,
|
||||
UserAddressId = defaultAddress.Id,
|
||||
@@ -158,7 +154,7 @@ public class InitiateBasePackagePaymentCommandHandler : IRequestHandler<Initiate
|
||||
Message = "تراکنش و سفارش با موفقیت ثبت شد.",
|
||||
OrderId = order.Id,
|
||||
TransactionId = transaction.Id,
|
||||
Amount = BasePackageAmount
|
||||
Amount = SystemConstants.BasePackageAmount
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
+5
-9
@@ -2,6 +2,7 @@ using CMSMicroservice.Application.Common.Exceptions;
|
||||
using CMSMicroservice.Application.Common.Interfaces;
|
||||
using CMSMicroservice.Domain.Entities;
|
||||
using CMSMicroservice.Domain.Enums;
|
||||
using CMSMicroservice.Domain.Common;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -24,11 +25,6 @@ public class VerifyBasePackagePaymentCommandHandler : IRequestHandler<VerifyBase
|
||||
{
|
||||
private readonly IApplicationDbContext _context;
|
||||
private readonly ILogger<VerifyBasePackagePaymentCommandHandler> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ پکیج پایه (56 میلیون تومان)
|
||||
/// </summary>
|
||||
private const long BasePackageAmount = 56_000_000;
|
||||
|
||||
public VerifyBasePackagePaymentCommandHandler(
|
||||
IApplicationDbContext context,
|
||||
@@ -136,8 +132,8 @@ public class VerifyBasePackagePaymentCommandHandler : IRequestHandler<VerifyBase
|
||||
var oldBalance = userWallet.Balance;
|
||||
var oldDiscountBalance = userWallet.DiscountBalance;
|
||||
|
||||
userWallet.Balance += BasePackageAmount;
|
||||
userWallet.DiscountBalance += BasePackageAmount;
|
||||
userWallet.Balance += SystemConstants.BasePackageAmount;
|
||||
userWallet.DiscountBalance += SystemConstants.BasePackageAmount;
|
||||
|
||||
_logger.LogInformation(
|
||||
"Charging wallet for user {UserId}. Balance: {OldBalance} -> {NewBalance}, DiscountBalance: {OldDiscount} -> {NewDiscount}",
|
||||
@@ -157,11 +153,11 @@ public class VerifyBasePackagePaymentCommandHandler : IRequestHandler<VerifyBase
|
||||
{
|
||||
WalletId = userWallet.Id,
|
||||
CurrentBalance = userWallet.Balance,
|
||||
ChangeValue = BasePackageAmount,
|
||||
ChangeValue = SystemConstants.BasePackageAmount,
|
||||
CurrentNetworkBalance = userWallet.NetworkBalance,
|
||||
ChangeNerworkValue = 0,
|
||||
CurrentDiscountBalance = userWallet.DiscountBalance,
|
||||
ChangeDiscountValue = BasePackageAmount,
|
||||
ChangeDiscountValue = SystemConstants.BasePackageAmount,
|
||||
IsIncrease = true,
|
||||
RefrenceId = transaction.Id
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user