예제 #1
0
        public IActionResult FinalyOrder(int orderId, int addressId)        //---id = orderId
        {
            _orderService.AddAddressToOrder(orderId, addressId);
            Order  order  = _orderService.GetOrderByOrderId(orderId);
            string roleId = User.FindFirst(ClaimTypes.Role)?.Value;

            if (order.OrderDetails == null)
            {
                return(Redirect("/"));
            }

            #region admin pyment

            if (roleId == "1")
            {
                return(RedirectToAction("OnlinePayment", "Home", new { area = "", id = orderId }));
            }

            #endregion

            #region onlin payment

            var payment = new Zarinpal.Payment("054939ee-3bc1-11ea-9822-000c295eb8fc", order.OrderSum + 15000);             //----15.000---هزینه پست
            var res     = payment.PaymentRequest("فروشگاه اینترنتی لیندا", "http://lindaunderwear.ir/OnlinePayment/" + orderId, "", "");

            if (res.Result.Status == 100)
            {
                return(Redirect("https://zarinpal.com/pg/StartPay/" + res.Result.Authority));
            }

            return(NotFound());

            #endregion
        }