Esempio n. 1
0
 public void RefreshReferenceData()
 {
     Run(new Action[]
     {
         () => _acumaticaManager.PullReferenceData(),
         () => _combinedRefDataService.ReconcileSettingsWithRefData(),
         () => _combinedRefDataService.ReconcilePaymentGatewaysWithRefData(),
         () => _combinedRefDataService.ReconcileShipRateToShipViaWithRefData(),
         () => _configStatusService.RefreshSettingsStatus(),
         () => _configStatusService.RefreshSettingsTaxesStatus(),
     },
         x => x.AcumaticaRefDataState);
 }
Esempio n. 2
0
        public ActionResult SettingsSelections(SettingsSelectionsModel selectionsModel)
        {
            var data = _settingsRepository.RetrieveSettings();

            // Save Settings
            //
            data.AcumaticaTimeZone            = selectionsModel.AcumaticaTimeZone;
            data.AcumaticaDefaultItemClass    = selectionsModel.AcumaticaDefaultItemClass;
            data.AcumaticaDefaultPostingClass = selectionsModel.AcumaticaDefaultPostingClass;
            data.AcumaticaCustomerClass       = selectionsModel.AcumaticaDefaultCustomerClass;

            _settingsRepository.SaveChanges();

            // Save Gateways
            //
            var gatewayRecords =
                selectionsModel.PaymentGateways.Select(x => new PaymentGateway()
            {
                ShopifyGatewayId       = x.ShopifyGatewayId,
                AcumaticaCashAccount   = x.AcumaticaCashAcount,
                AcumaticaPaymentMethod = x.AcumaticaPaymentMethod,
            })
                .ToList();

            _settingsRepository.ImprintPaymentGateways(gatewayRecords);

            // Save Carrier-to-Ship-Via mappings
            //
            var carrierToShipVia =
                selectionsModel.RateToShipVias.Select(x => new RateToShipVia()
            {
                ShopifyRateName    = x.ShopifyRateName,
                AcumaticaShipViaId = x.AcumaticaCarrierId,
            })
                .ToList();

            _settingsRepository.ImprintRateToShipVias(carrierToShipVia);

            // Refresh the Settings Status
            //
            _statusService.RefreshSettingsStatus();

            return(JsonNetResult.Success());
        }