Esempio n. 1
0
 /// <summary>
 /// Get the tracker of the shipment
 /// </summary>
 /// <param name="shipment">Shipment</param>
 /// <returns>Shipment tracker</returns>
 public virtual IShipmentTracker GetShipmentTracker(Shipment shipment)
 {
     if (!shipment.Order.PickupInStore)
     {
         var shippingRateComputationMethod = _shippingPluginManager
                                             .LoadPluginBySystemName(shipment.Order.ShippingRateComputationMethodSystemName);
         return(shippingRateComputationMethod?.ShipmentTracker);
     }
     else
     {
         var pickupPointProvider = _pickupPluginManager
                                   .LoadPluginBySystemName(shipment.Order.ShippingRateComputationMethodSystemName);
         return(pickupPointProvider?.ShipmentTracker);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Get the tracker of the shipment
        /// </summary>
        /// <param name="shipment">Shipment</param>
        /// <returns>Shipment tracker</returns>
        public virtual IShipmentTracker GetShipmentTracker(Shipment shipment)
        {
            var order = _orderRepository.ToCachedGetById(shipment.OrderId);

            if (!order.PickupInStore)
            {
                var shippingRateComputationMethod = _shippingPluginManager
                                                    .LoadPluginBySystemName(order.ShippingRateComputationMethodSystemName);

                return(shippingRateComputationMethod?.ShipmentTracker);
            }

            var pickupPointProvider = _pickupPluginManager
                                      .LoadPluginBySystemName(order.ShippingRateComputationMethodSystemName);

            return(pickupPointProvider?.ShipmentTracker);
        }
Esempio n. 3
0
        public virtual IActionResult PickupPointProviderUpdate(PickupPointProviderModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings))
            {
                return(AccessDeniedView());
            }

            var pickupPointProvider = _pickupPluginManager.LoadPluginBySystemName(model.SystemName);

            if (_pickupPluginManager.IsPluginActive(pickupPointProvider))
            {
                if (!model.IsActive)
                {
                    //mark as disabled
                    _shippingSettings.ActivePickupPointProviderSystemNames.Remove(pickupPointProvider.PluginDescriptor.SystemName);
                    _settingService.SaveSetting(_shippingSettings);
                }
            }
            else
            {
                if (model.IsActive)
                {
                    //mark as active
                    _shippingSettings.ActivePickupPointProviderSystemNames.Add(pickupPointProvider.PluginDescriptor.SystemName);
                    _settingService.SaveSetting(_shippingSettings);
                }
            }

            var pluginDescriptor = pickupPointProvider.PluginDescriptor;

            pluginDescriptor.DisplayOrder = model.DisplayOrder;

            //update the description file
            pluginDescriptor.Save();

            //raise event
            _eventPublisher.Publish(new PluginUpdatedEvent(pluginDescriptor));

            return(new NullJsonResult());
        }