feat(wallet): add credit wallet functionality and update Protobuf definitions
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 9m49s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 9m49s
- Introduced new CreditWalletCharge enum value to TransactionType for clarity. - Implemented InitiateCreditCharge and VerifyCreditCharge methods in UserWalletService for handling credit wallet transactions. - Updated ZarinpalReconciliationJob to support credit wallet payment verification. - Enhanced Protobuf definitions with new messages and RPC methods for credit wallet operations. - Bumped Protobuf project version to reflect the addition of new features.
This commit is contained in:
@@ -3,6 +3,7 @@ using CMSMicroservice.Application.PackageCQ.Commands.VerifyUserPackagePurchasePa
|
||||
using CMSMicroservice.Application.Common.Interfaces;
|
||||
using CMSMicroservice.Application.DiscountShopCQ.Commands.CompleteOrderPayment;
|
||||
using CMSMicroservice.Application.WalletCQ.Commands.VerifyDiscountWalletCharge;
|
||||
using CMSMicroservice.Application.WalletCQ.Commands.VerifyCreditWalletCharge;
|
||||
using CMSMicroservice.Application.WalletCQ.Commands.VerifyMagicWalletCharge;
|
||||
using CMSMicroservice.Domain.Entities;
|
||||
using CMSMicroservice.Domain.Entities.Payment;
|
||||
@@ -174,6 +175,19 @@ public class ZarinpalReconciliationJob
|
||||
}, ct);
|
||||
break;
|
||||
|
||||
case "credit-wallet":
|
||||
if (!paymentTx.UserId.HasValue)
|
||||
throw new InvalidOperationException(
|
||||
$"UserId is null for credit-wallet authority {authority}");
|
||||
|
||||
await _sender.Send(new VerifyCreditWalletChargeCommand
|
||||
{
|
||||
Authority = authority,
|
||||
UserId = paymentTx.UserId.Value,
|
||||
Amount = paymentTx.Amount
|
||||
}, ct);
|
||||
break;
|
||||
|
||||
case "discount-order":
|
||||
await ReconcileDiscountOrderAsync(paymentTx, ct);
|
||||
break;
|
||||
@@ -194,6 +208,8 @@ public class ZarinpalReconciliationJob
|
||||
return "magic-wallet";
|
||||
if (callbackUrl.Contains("type=discount-wallet", StringComparison.OrdinalIgnoreCase))
|
||||
return "discount-wallet";
|
||||
if (callbackUrl.Contains("type=credit-wallet", StringComparison.OrdinalIgnoreCase))
|
||||
return "credit-wallet";
|
||||
if (callbackUrl.Contains("type=discount-order", StringComparison.OrdinalIgnoreCase))
|
||||
return "discount-order";
|
||||
// Package callbacks have orderId= but no type= parameter
|
||||
|
||||
Reference in New Issue
Block a user