public ShopManagerController(IShopService shopService, IRustShopService rustShopService, UserManager <AppUser> userManager, IConfiguration configuration)
 {
     _shopService     = shopService;
     _rustShopService = rustShopService;
     _userManager     = userManager;
     _configuration   = configuration;
 }
Esempio n. 2
0
 public PayPalExecutedPaymentService(
     EasyShopContext easyShopContext,
     ILogger <PayPalExecutedPaymentService> logger,
     IRustShopService rustShopService,
     ISteamUserService steamUserService)
 {
     _easyShopContext  = easyShopContext;
     _logger           = logger;
     _rustShopService  = rustShopService;
     _steamUserService = steamUserService;
 }
Esempio n. 3
0
 public PurchaseController(
     IRustStoreStandardProductPurchaseService rustStoreStandardProductPurchaseService,
     IRustPurchaseStatsServiceSql rustPurchaseStatsServiceSql,
     IRustShopService rustShopService,
     ISteamUserService steamUserService)
 {
     _rustStoreStandardProductPurchaseService = rustStoreStandardProductPurchaseService;
     _rustPurchaseStatsServiceSql             = rustPurchaseStatsServiceSql;
     _rustShopService  = rustShopService;
     _steamUserService = steamUserService;
 }
        public RustShopSalesService(
            EasyShopContext easyShopContext,
            UserManager <AppUser> userManager,
            IHttpContextAccessor httpContextAccessor,
            IRustShopService rustShopService,
            IConfiguration configuration,
            PayPalSettings payPalSettings)
        {
            _easyShopContext = easyShopContext;
            _configuration   = configuration;
            _payPalSettings  = payPalSettings;

            _currentRequestAppUser =
                userManager.FindByEmailAsync(httpContextAccessor.HttpContext.User.Identity.Name).Result;
        }
Esempio n. 5
0
 public RustTestStatsData(
     IShopService shopService,
     UserManager <AppUser> userManager,
     IRustShopService rustShopService,
     EasyShopContext easyShopContext,
     IRustDefaultCategoriesWithItemsService rustDefaultCategoriesWithItemsService,
     IMultiTenancyStoreService tenancyStoreService)
 {
     _shopService     = shopService;
     _userManager     = userManager;
     _rustShopService = rustShopService;
     _easyShopContext = easyShopContext;
     _rustDefaultCategoriesWithItemsService = rustDefaultCategoriesWithItemsService;
     _tenancyStoreService = tenancyStoreService;
 }
 public RustStoreStandardProductPurchaseService(
     ISteamUserService steamUserService,
     EasyShopContext easyShopContext,
     IRustShopService rustShopService,
     UserManager <AppUser> userManager,
     ILogger <RustStoreStandardProductPurchaseService> logger,
     PayPalSettings payPalSettings,
     IConfiguration configuration)
 {
     _steamUserService             = steamUserService;
     _easyShopContext              = easyShopContext;
     _rustShopService              = rustShopService;
     _userManager                  = userManager;
     _logger                       = logger;
     _servicePercentPerTransaction =
         configuration.GetValue <int>("ServicePercentPerTransaction") + payPalSettings.Fees;
 }
Esempio n. 7
0
 public RustShopController(
     IShopService shopService,
     IRustShopService rustShopService,
     IHttpContextAccessor httpContextAccessor,
     IRustServerService rustServerService,
     UserManager <AppUser> userManager,
     IRustShopStatsService rustShopStatsService,
     IRustShopSalesService rustShopSalesService)
 {
     _shopService          = shopService;
     _rustShopService      = rustShopService;
     _httpContextAccessor  = httpContextAccessor;
     _rustServerService    = rustServerService;
     _userManager          = userManager;
     _rustShopStatsService = rustShopStatsService;
     _rustShopSalesService = rustShopSalesService;
 }
Esempio n. 8
0
 public TenantNavBarViewComponent(IHttpContextAccessor httpContextAccessor, IRustShopService rustShopService)
 {
     _httpContextAccessor = httpContextAccessor;
     _rustShopService     = rustShopService;
 }
        public async Task InvokeAsync(HttpContext httpContext, EasyShopContext easyShopContext, IRustShopService rustShopService)
        {
            _easyShopContext = easyShopContext;
            _rustShopService = rustShopService;

            EasyShop.Domain.Entries.Shop.Shop shop = null;

            try
            {
                var tenantContext = httpContext.GetMultiTenantContext();
                shop = _rustShopService.GetShopById(Guid.Parse(tenantContext.TenantInfo.Id));
            }
            catch
            {
                await _next(httpContext);
            }

            if (httpContext.User.Identity.IsAuthenticated)
            {
                var steamUser = _easyShopContext.SteamUsers.FirstOrDefault(x => x.Uid == GetSteamUserUid(httpContext));

                if (steamUser is null)
                {
                    Guid newSteamUserGuid;

                    do
                    {
                        newSteamUserGuid = Guid.NewGuid();
                    } while (_easyShopContext.SteamUsers.FirstOrDefault(x => x.Id == newSteamUserGuid) != null);

                    var newSteamUser = new SteamUser
                    {
                        Id         = newSteamUserGuid,
                        Uid        = GetSteamUserUid(httpContext),
                        TotalSpent = 0m
                    };

                    if (shop != null)
                    {
                        var newSteamUserShop = new SteamUserShop
                        {
                            Shop       = shop,
                            SteamUser  = newSteamUser,
                            Balance    = shop.StartBalance,
                            TotalSpent = 0m
                        };

                        _easyShopContext.SteamUsersShops.Add(newSteamUserShop);
                    }

                    _easyShopContext.SteamUsers.Add(newSteamUser);
                    await _easyShopContext.SaveChangesAsync();
                }
                else
                {
                    var steamUserShop =
                        _easyShopContext.SteamUsersShops.FirstOrDefault(x =>
                                                                        x.SteamUser.Id == steamUser.Id && x.Shop.Id == shop.Id);

                    if (steamUserShop is null)
                    {
                        var newSteamUserShop = new SteamUserShop
                        {
                            Shop         = shop,
                            SteamUser    = steamUser,
                            Balance      = shop.StartBalance,
                            TotalSpent   = 0m,
                            StartBalance = shop.StartBalance
                        };

                        _easyShopContext.SteamUsersShops.Add(newSteamUserShop);
                        await _easyShopContext.SaveChangesAsync();
                    }
                }
            }

            await _next(httpContext);
        }
Esempio n. 10
0
 public StoreController(ILogger <StoreController> logger, IRustShopService rustShopService, EasyShopContext easyShopContext)
 {
     _logger          = logger;
     _rustShopService = rustShopService;
     _easyShopContext = easyShopContext;
 }