Esempio n. 1
0
        private static AvaTaxController GetTaxController()
        {
            var avalaraUsername    = "******";
            var avalaraPassword    = "******";
            var avalaraServiceUrl  = "https://development.avalara.net";
            var avalaraCompanyCode = "APITrialCompany";

            const string _usernamePropertyName    = "Avalara.Tax.Credentials.AccountNumber";
            const string _passwordPropertyName    = "Avalara.Tax.Credentials.LicenseKey";
            const string _serviceUrlPropertyName  = "Avalara.Tax.Credentials.ServiceUrl";
            const string _companyCodePropertyName = "Avalara.Tax.Credentials.CompanyCode";
            const string _isEnabledPropertyName   = "Avalara.Tax.IsEnabled";

            var settings = new List <SettingEntry>
            {
                new SettingEntry
                {
                    Value     = avalaraUsername,
                    Name      = _usernamePropertyName,
                    ValueType = SettingValueType.ShortText
                },
                new SettingEntry
                {
                    Value     = avalaraPassword,
                    Name      = _passwordPropertyName,
                    ValueType = SettingValueType.ShortText
                },
                new SettingEntry
                {
                    Value     = avalaraServiceUrl,
                    Name      = _serviceUrlPropertyName,
                    ValueType = SettingValueType.ShortText
                },
                new SettingEntry
                {
                    Value     = avalaraCompanyCode,
                    Name      = _companyCodePropertyName,
                    ValueType = SettingValueType.ShortText
                },
                new SettingEntry {
                    Value = "True", Name = _isEnabledPropertyName, ValueType = SettingValueType.Boolean
                }
            };

            var settingsManager = new Moq.Mock <ISettingsManager>();

            var avalaraTax = new AvaTaxImpl(_usernamePropertyName, _passwordPropertyName, _serviceUrlPropertyName, _companyCodePropertyName, _isEnabledPropertyName, settingsManager.Object);

            var controller = new AvaTaxController(avalaraTax);

            return(controller);
        }
Esempio n. 2
0
        public override void Initialize()
        {
            var settingsManager = _container.Resolve<ISettingsManager>();
            
            var avalaraTax = new AvaTaxImpl(_usernamePropertyName, _passwordPropertyName, _serviceUrlPropertyName, _companyCodePropertyName, _isEnabledPropertyName, settingsManager);
            
            _container.RegisterType<AvaTaxController>
                (new InjectionConstructor(
                    avalaraTax));

            //Subscribe to cart changes. Calculate taxes   
            _container.RegisterType<IObserver<CartChangeEvent>, CalculateCartTaxesObserver>("CalculateCartTaxesObserver", new InjectionConstructor(avalaraTax));

            //Subscribe to order changes. Calculate taxes   
            _container.RegisterType<IObserver<OrderChangeEvent>, CalculateOrderTaxesObserver>("CalculateOrderTaxesObserver", new InjectionConstructor(avalaraTax));
        }
Esempio n. 3
0
        public override void Initialize()
        {
            var settingsManager = _container.Resolve <ISettingsManager>();

            var avalaraTax = new AvaTaxImpl(_usernamePropertyName, _passwordPropertyName, _serviceUrlPropertyName, _companyCodePropertyName, _isEnabledPropertyName, settingsManager);

            _container.RegisterType <AvaTaxController>
                (new InjectionConstructor(
                    avalaraTax));

            //Subscribe to cart changes. Calculate taxes
            _container.RegisterType <IObserver <CartChangeEvent>, CalculateCartTaxesObserver>("CalculateCartTaxesObserver", new InjectionConstructor(avalaraTax));

            //Subscribe to order changes. Calculate taxes
            _container.RegisterType <IObserver <OrderChangeEvent>, CalculateOrderTaxesObserver>("CalculateOrderTaxesObserver", new InjectionConstructor(avalaraTax));
        }
Esempio n. 4
0
        private static AvaTaxController GetTaxController()
        {
            var avalaraUsername = "******";
            var avalaraPassword = "******";
            var avalaraServiceUrl = "https://development.avalara.net";
            var avalaraCompanyCode = "APITrialCompany";
            
            const string _usernamePropertyName = "Avalara.Tax.Credentials.AccountNumber";
            const string _passwordPropertyName = "Avalara.Tax.Credentials.LicenseKey";
            const string _serviceUrlPropertyName = "Avalara.Tax.Credentials.ServiceUrl";
            const string _companyCodePropertyName = "Avalara.Tax.Credentials.CompanyCode";
            const string _isEnabledPropertyName = "Avalara.Tax.IsEnabled";

            var settings = new List<SettingEntry>
            {
                new SettingEntry
                {
                    Value = avalaraUsername,
                    Name = _usernamePropertyName,
                    ValueType = SettingValueType.ShortText
                },
                new SettingEntry
                {
                    Value = avalaraPassword,
                    Name = _passwordPropertyName,
                    ValueType = SettingValueType.ShortText
                },
                new SettingEntry
                {
                    Value = avalaraServiceUrl,
                    Name = _serviceUrlPropertyName,
                    ValueType = SettingValueType.ShortText
                },
                new SettingEntry
                {
                    Value = avalaraCompanyCode,
                    Name = _companyCodePropertyName,
                    ValueType = SettingValueType.ShortText
                },
                new SettingEntry { Value = "True", Name = _isEnabledPropertyName, ValueType = SettingValueType.Boolean }
            };

            var settingsManager = new Moq.Mock<ISettingsManager>();
            
            var avalaraTax = new AvaTaxImpl(_usernamePropertyName, _passwordPropertyName, _serviceUrlPropertyName, _companyCodePropertyName, _isEnabledPropertyName, settingsManager.Object);

            var controller = new AvaTaxController(avalaraTax);
            return controller;
        }