Phase 7b: Migrate deprecated RPCs to Customer* RPCs

- Profile/Index: InitiateBasePackagePayment → CustomerPurchasePackage
  - Fetches base package via GetCustomerPackages, passes PackageId + PurchaseMethod
- Profile/PaymentCallback: VerifyBasePackagePayment → CustomerVerifyPackagePurchase
  - Uses Authority/Status (from ZarinPal callback) + orderId (from embedded URL param)
  - TransactionId no longer required (CMS finds it internally)
This commit is contained in:
masoodafar-web
2026-02-26 02:35:59 +03:30
parent b82cac4af1
commit 71f391ac80
2 changed files with 30 additions and 14 deletions
@@ -101,7 +101,7 @@
{
try
{
if (OrderId <= 0 || TransactionId <= 0 || string.IsNullOrEmpty(Authority))
if (OrderId <= 0 || string.IsNullOrEmpty(Authority))
{
_isSuccess = false;
_message = "پارامترهای پرداخت نامعتبر است";
@@ -110,20 +110,23 @@
return;
}
var response = await PackageContractClient.VerifyBasePackagePaymentAsync(new VerifyBasePackagePaymentRequest
var response = await PackageContractClient.CustomerVerifyPackagePurchaseAsync(new CustomerVerifyPackagePurchaseRequest
{
OrderId = OrderId,
TransactionId = TransactionId,
PaymentSuccess = Status == "OK",
RefId = !string.IsNullOrEmpty(Authority) ? Authority : null,
Message = !string.IsNullOrEmpty(Status) ? Status : null
Authority = Authority ?? string.Empty,
Status = Status ?? string.Empty
});
_isSuccess = response.Success;
_message = response.Message;
_refId = response.ReferenceCode ?? "";
_walletBalance = response.WalletBalance;
_discountBalance = response.DiscountBalance;
// Wallet balances are no longer in verify response — show from purchase info
if (response.PurchaseInfo != null)
{
_walletBalance = response.PurchaseInfo.AmountPaid;
_discountBalance = 0; // Available in wallet page
}
// اگر پرداخت موفق بود، توکن را refresh می‌کنیم
// چون PackagePurchaseMethod تغییر کرده و باید در claims جدید باشد