Esempio n. 1
0
 public EasyPostController(EasyPostModelFactory easyPostModelFactory,
                           EasyPostService easyPostService,
                           EasyPostSettings easyPostSettings,
                           ICurrencyService currencyService,
                           IDateTimeHelper dateTimeHelper,
                           IHttpClientFactory httpClientFactory,
                           ILocalizationService localizationService,
                           IMeasureService measureService,
                           INopFileProvider nopFileProvider,
                           INotificationService notificationService,
                           IOrderModelFactory orderModelFactory,
                           IPermissionService permissionService,
                           ISettingService settingService,
                           IShipmentService shipmentService,
                           ShippingSettings shippingSettings)
 {
     _easyPostModelFactory = easyPostModelFactory;
     _easyPostService      = easyPostService;
     _easyPostSettings     = easyPostSettings;
     _currencyService      = currencyService;
     _dateTimeHelper       = dateTimeHelper;
     _httpClientFactory    = httpClientFactory;
     _localizationService  = localizationService;
     _measureService       = measureService;
     _nopFileProvider      = nopFileProvider;
     _notificationService  = notificationService;
     _orderModelFactory    = orderModelFactory;
     _permissionService    = permissionService;
     _settingService       = settingService;
     _shipmentService      = shipmentService;
     _shippingSettings     = shippingSettings;
 }
Esempio n. 2
0
 public EventConsumer(EasyPostService easyPostService,
                      IGenericAttributeService genericAttributeService,
                      IHttpContextAccessor httpContextAccessor,
                      IPermissionService permissionService,
                      IProductService productService,
                      IShippingPluginManager shippingPluginManager)
 {
     _easyPostService         = easyPostService;
     _genericAttributeService = genericAttributeService;
     _httpContextAccessor     = httpContextAccessor;
     _permissionService       = permissionService;
     _productService          = productService;
     _shippingPluginManager   = shippingPluginManager;
 }
Esempio n. 3
0
 public EasyPostModelFactory(EasyPostService easyPostService,
                             IAddressModelFactory addressModelFactory,
                             IAddressService addressService,
                             IGenericAttributeService genericAttributeService,
                             ILocalizationService localizationService,
                             IPriceFormatter priceFormatter)
 {
     _easyPostService         = easyPostService;
     _addressModelFactory     = addressModelFactory;
     _addressService          = addressService;
     _genericAttributeService = genericAttributeService;
     _localizationService     = localizationService;
     _priceFormatter          = priceFormatter;
 }
 public EasyPostProvider(EasyPostService easyPostService,
                         IActionContextAccessor actionContextAccessor,
                         ILocalizationService localizationService,
                         IPermissionService permissionService,
                         ISettingService settingService,
                         IShippingPluginManager shippingPluginManager,
                         IUrlHelperFactory urlHelperFactory,
                         WidgetSettings widgetSettings)
 {
     _easyPostService       = easyPostService;
     _actionContextAccessor = actionContextAccessor;
     _localizationService   = localizationService;
     _permissionService     = permissionService;
     _settingService        = settingService;
     _shippingPluginManager = shippingPluginManager;
     _urlHelperFactory      = urlHelperFactory;
     _widgetSettings        = widgetSettings;
 }
 public ShipmentDetailsViewComponentName(EasyPostModelFactory easyPostModelFactory,
                                         EasyPostService easyPostService,
                                         IGenericAttributeService genericAttributeService,
                                         ILocalizationService localizationService,
                                         IOrderService orderService,
                                         IPermissionService permissionService,
                                         IPriceFormatter priceFormatter,
                                         IShipmentService shipmentService,
                                         IShippingPluginManager shippingPluginManager)
 {
     _easyPostModelFactory    = easyPostModelFactory;
     _easyPostService         = easyPostService;
     _genericAttributeService = genericAttributeService;
     _localizationService     = localizationService;
     _orderService            = orderService;
     _permissionService       = permissionService;
     _priceFormatter          = priceFormatter;
     _shipmentService         = shipmentService;
     _shippingPluginManager   = shippingPluginManager;
 }
Esempio n. 6
0
        public async Task <IActionResult> Configure(ConfigurationModel model)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageShippingSettings))
            {
                return(AccessDeniedView());
            }

            if (!ModelState.IsValid)
            {
                return(await Configure());
            }

            _easyPostSettings.ApiKey     = model.ApiKey;
            _easyPostSettings.TestApiKey = model.TestApiKey;
            _easyPostSettings.UseSandbox = model.UseSandbox;
            _easyPostSettings.UseAllAvailableCarriers   = model.UseAllAvailableCarriers;
            _easyPostSettings.CarrierAccounts           = model.CarrierAccounts?.ToList();
            _easyPostSettings.AddressVerification       = model.AddressVerification;
            _easyPostSettings.StrictAddressVerification = model.StrictAddressVerification;
            await _settingService.SaveSettingAsync(_easyPostSettings);

            //reset client configuration
            EasyPostService.ResetClientConfiguration();

            //create webhook
            var(webhook, webhookError) = await _easyPostService.CreateWebhookAsync();

            if (!string.IsNullOrEmpty(webhookError))
            {
                var locale = await _localizationService.GetResourceAsync("Plugins.Shipping.EasyPost.Error");

                var errorMessage = string.Format(locale, webhookError, Url.Action("List", "Log"));
                _notificationService.ErrorNotification(errorMessage, false);
            }
            await _settingService.SetSettingAsync($"{nameof(EasyPostSettings)}.{nameof(EasyPostSettings.WebhookUrl)}", webhook?.url);

            _notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Admin.Plugins.Saved"));

            return(await Configure());
        }
Esempio n. 7
0
 public EasyPostTracker(EasyPostService easyPostService,
                        IShippingPluginManager shippingPluginManager)
 {
     _easyPostService       = easyPostService;
     _shippingPluginManager = shippingPluginManager;
 }
 public EasyPostPublicController(EasyPostService easyPostService)
 {
     _easyPostService = easyPostService;
 }