From 8b9c317de6199305c5f106560bc2eb5173b2cef8 Mon Sep 17 00:00:00 2001 From: masoodafar-web Date: Tue, 24 Feb 2026 21:52:36 +0330 Subject: [PATCH] =?UTF-8?q?fix:=20Phase=200=20=E2=80=94=20critical=20bugs?= =?UTF-8?q?=20in=20package=20purchase=20handlers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit B1: VerifyGoldenPackagePurchase — DiscountBalance was NOT charged (Amount × 2) Now charges DiscountBalance same as all other handlers. B2: VerifyGoldenPackagePurchase — UserPackagePurchase record was NOT created Now creates UPP with OrderId and TransactionId. B3: VerifyPackagePurchase — UserPackagePurchase record was NOT created Now creates UPP after wallet charge. B4: VerifyBasePackagePayment — UserPackagePurchase record was NOT created Now creates UPP after wallet change log. Also: VerifyGolden WalletChangeLog split into 2 logs (Balance + Discount) to match the pattern used by VerifyPackagePurchase. Transaction description changed from 'پکیج طلایی' to 'پکیج' (generic). Impact: Only Daya Loan handler was creating UserPackagePurchase before. Now all 4 payment paths create it consistently. --- .../VerifyBasePackagePaymentCommandHandler.cs | 24 +++++++- ...rifyGoldenPackagePurchaseCommandHandler.cs | 56 ++++++++++++++++--- .../VerifyPackagePurchaseCommandHandler.cs | 24 +++++++- 3 files changed, 92 insertions(+), 12 deletions(-) diff --git a/src/CMSMicroservice.Application/PackageCQ/Commands/VerifyBasePackagePayment/VerifyBasePackagePaymentCommandHandler.cs b/src/CMSMicroservice.Application/PackageCQ/Commands/VerifyBasePackagePayment/VerifyBasePackagePaymentCommandHandler.cs index b7d79c3..bda6448 100644 --- a/src/CMSMicroservice.Application/PackageCQ/Commands/VerifyBasePackagePayment/VerifyBasePackagePaymentCommandHandler.cs +++ b/src/CMSMicroservice.Application/PackageCQ/Commands/VerifyBasePackagePayment/VerifyBasePackagePaymentCommandHandler.cs @@ -164,13 +164,33 @@ public class VerifyBasePackagePaymentCommandHandler : IRequestHandler {NewBalance}, DiscountBalance: {OldDiscount} -> {NewDiscount}", order.UserId, oldBalance, - wallet.Balance); + wallet.Balance, + oldDiscountBalance, + wallet.DiscountBalance); // 5. ثبت Transaction var transaction = new Transaction { Amount = order.Amount, - Description = $"خرید پکیج طلایی از درگاه - سفارش #{order.Id}", + Description = $"خرید پکیج از درگاه - سفارش #{order.Id}", PaymentStatus = PaymentStatus.Success, PaymentDate = DateTime.Now, RefId = verifyResult.RefId, @@ -133,23 +139,57 @@ public class VerifyGoldenPackagePurchaseCommandHandler : IRequestHandler