Exemplo n.º 1
0
        public void EndToEndSync()
        {
            var settings = _settingsRepository.RetrieveSettings();

            if (settings.PullFromShopifyEnabled)
            {
                RunPullFromShopify();
            }

            if (settings.PullFromAcumaticaEnabled)
            {
                RunPullFromAcumatica();
            }

            if (settings.SyncFulfillmentsEnabled &&
                _stateRepository.CheckSystemState(x => x.CanSyncFulfillmentsToShopify()))
            {
                if (TestIsShopifyPutEnabled())
                {
                    Run(new Action[]
                    {
                        () => _syncManager.SyncFulfillmentsToShopify()
                    });
                }
            }

            if (settings.SyncOrdersEnabled)
            {
                Run(new Action[]
                {
                    () => _syncManager.SyncCustomersToAcumatica(),
                    () => _syncManager.SyncOrdersToAcumatica(),
                    () => _syncManager.SyncPaymentsToAcumatica(),
                });
            }

            if (settings.SyncInventoryEnabled &&
                _stateRepository.CheckSystemState(x => x.CanSyncInventoryCountsToShopify()))
            {
                Run(new Action[]
                {
                    () => _shopifyManager.PullInventory(),
                    () => _acumaticaManager.PullInventory(),
                });

                if (TestIsShopifyPutEnabled())
                {
                    Run(() => _syncManager.SyncInventoryCountsToShopify());
                }
            }
        }