Example #1
0
        public ActionResult VerifyShopifyOrder(string orderNameOrId)
        {
            var identity = HttpContext.GetIdentity();

            _instanceContext.InitializeShopify();

            var jsonByName   = _shopifyOrderApi.RetrieveByName(orderNameOrId);
            var ordersByName = jsonByName.DeserializeToOrderList().orders;

            if (ordersByName.Count > 0)
            {
                return(new JsonNetResult(MakeOrderVerification(ordersByName.First())));
            }

            if (orderNameOrId.IsLong())
            {
                var jsonById  = _shopifyOrderApi.Retrieve(orderNameOrId.ToLong());
                var orderById = jsonById.DeserializeToOrderParent().order;
                if (orderById != null)
                {
                    return(new JsonNetResult(orderById));
                }
            }

            return(new JsonNetResult(OrderVerification.Empty()));
        }