public ValidationResult Validate(AcumaticaSoShipment shipmentRecord) { var output = new CreateFulfillmentValidation(); var salesOrder = shipmentRecord.AcumaticaSalesOrder; var shopifyOrderId = salesOrder.OriginalShopifyOrder().ShopifyOrderId; // Fulfilled in Shopify - thus corrupted! // output.AnyShopifyMadeFulfillments = _syncOrderRepository.AnyUnsyncedFulfillments(shopifyOrderId); // Unmatched Warehouse // var shipment = shipmentRecord.AcumaticaShipmentJson.DeserializeFromJson <Shipment>(); var warehouseRecord = _syncInventoryRepository.RetrieveWarehouse(shipment.WarehouseID.value); var locationRecord = warehouseRecord.MatchedLocation(); if (locationRecord == null) { output.WarehouseLocationUnmatched = true; } // Unmatched Stock Item/Inventory // foreach (var line in shipment.Details) { var stockItem = _syncInventoryRepository.RetrieveStockItem(line.InventoryID.value); var variant = stockItem.MatchedVariant(); if (variant == null) { output.UnmatchedVariantStockItems.Add(stockItem.ItemId); continue; } } // Error threshold // output.ErrorThresholdExceeded = salesOrder.OriginalShopifyOrder().ExceedsErrorLimit(); return(output.Result()); }