public void OnGet() { var serializer = new JavaScriptSerializer(); var value = Request.Cookies[CookieName]; var cartItems = serializer.Deserialize <List <CartItem> >(value); foreach (var item in cartItems) { item.CalculateTotalItemPrice(); } CartItems = _productQuery.CheckInventoryStatus(cartItems); }
public IActionResult OnGetPay() { var cart = _cartService.Get(); var result = _productQuery.CheckInventoryStatus(cart.Items); if (result.Any(x => !x.IsInStock)) { return(RedirectToPage("/Cart")); } var orderId = _orderApplication.PlaceOrder(cart); var paymentResponse = _zarinPalFactory.CreatePaymentRequest( cart.PayAmount.ToString(CultureInfo.InvariantCulture), "", "", "خرید از فروشگاه دکومال", orderId ); return(Redirect($"https://{_zarinPalFactory.Prefix}.zarinpal.com/pg/StartPay/{paymentResponse.Authority}")); }