Phase 7b: Embed orderId in callback URL for CustomerPurchasePackage
- CustomerPurchasePackage: append orderId to callback URL before sending to gateway - Ensures PaymentCallback page receives orderId via query string for verification
This commit is contained in:
@@ -207,13 +207,17 @@ public class PackageService : PackageContract.PackageContractBase
|
||||
.Select(u => new { u.Mobile })
|
||||
.FirstOrDefaultAsync(context.CancellationToken);
|
||||
|
||||
// Embed orderId in callback URL so FrontOffice can pass it back for verification
|
||||
var separator = request.CallbackUrl.Contains('?') ? "&" : "?";
|
||||
var callbackWithOrder = $"{request.CallbackUrl}{separator}orderId={purchase.Id}";
|
||||
|
||||
var paymentResult = await _paymentGateway.InitiatePaymentAsync(new PaymentRequest
|
||||
{
|
||||
Amount = package.Price,
|
||||
UserId = userId,
|
||||
Mobile = user?.Mobile ?? string.Empty,
|
||||
Description = $"خرید پکیج {package.Title}",
|
||||
CallbackUrl = request.CallbackUrl
|
||||
CallbackUrl = callbackWithOrder
|
||||
}, context.CancellationToken);
|
||||
|
||||
if (!paymentResult.IsSuccess)
|
||||
|
||||
Reference in New Issue
Block a user