Beispiel #1
0
        public POSInterfaceProvider(POSConfigurationList configuration, IConfigurationProvider configProvider)
        {
            _posInterfaces = new List <IPOSInterface>();
            foreach (var posCfg in configuration.PosConfigurations)
            {
                switch (posCfg.Type)
                {
                case EnumPOSTypes.SQUAREPOS:
                    _posInterfaces.Add(new SquarePOS(posCfg.AccessToken,
                                                     posCfg.AccountID));
                    break;

                case EnumPOSTypes.HIBOUTIK:
                    _posInterfaces.Add(new HiboutikPOS(posCfg.AccessToken,
                                                       posCfg.EmailAddress,
                                                       posCfg.AccountName,
                                                       posCfg.StoreID,
                                                       posCfg.HiboutikCustomerID,
                                                       posCfg.MaximumRequests));
                    break;

                case EnumPOSTypes.LIGHTSPEED:
                    _posInterfaces.Add(new LightspeedPOS(posCfg.AccessToken,
                                                         posCfg.RefreshToken,
                                                         posCfg.ClientID,
                                                         posCfg.ClientSecret,
                                                         posCfg.LightspeedCustomerID,
                                                         posCfg.AccountID,
                                                         posCfg.EmployeeID,
                                                         posCfg.RegisterID,
                                                         posCfg.ShopID));
                    break;

                case EnumPOSTypes.MOBILE_CLIENT:
                    _posInterfaces.Add(new MobileClient(posCfg.AccountID, configProvider.GetFirebaseServerToken(), posCfg.FirebaseFCMID));
                    break;

                default:
                    throw new ArgumentOutOfRangeException("Unrecognized POS type");
                }
            }
        }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();

            var cfg = new POSConfigurationList();

            Configuration.Bind("PosAccess", cfg);

            services.AddSingleton <ApplicationState>();
            services.AddSingleton <Synchronizer>();
            services.AddAutoMapper();

            services.AddSingleton <Utilities.IConfigurationProvider>(new Utilities.ConfigurationProvider()
            {
                DatabaseConnectionString = Configuration["ecommerceDatabaseConnectionString"],
                FirebaseServerToken      = Configuration["FirebaseFCMToken"]
            });

            services.AddSingleton(cfg);
            services.AddSingleton <IPOSInterfaceProvider, POSInterfaceProvider>();
            services.AddSingleton <IEcommerceDatabase, EcommerceDatabase>();

            services.AddHangfire(x => x.UseSqlServerStorage(Configuration["hangfireDatabaseConnectionString"]));
        }