Beispiel #1
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            Balance = new BonusBalance();
            var bonusApiMock = new Mock <IBonusApiProxy>();

            bonusApiMock.Setup(proxy => proxy.GetPlayerBalanceAsync(It.IsAny <Guid>(), It.IsAny <Guid?>())).ReturnsAsync(Balance);
            bonusApiMock.Setup(proxy => proxy.GetWageringBalancesAsync(It.IsAny <Guid>(), It.IsAny <Guid?>())).ReturnsAsync(new PlayerWagering());
            Container.RegisterInstance(bonusApiMock.Object);

            _withdrawalService = Container.Resolve <IWithdrawalService>();
            _playerQueries     = Container.Resolve <PlayerQueries>();
            _paymentRepository = Container.Resolve <FakePaymentRepository>();
            _paymentTestHelper = Container.Resolve <PaymentTestHelper>();
            Container.Resolve <PaymentWorker>().Start();
            var securityTestHelper = Container.Resolve <SecurityTestHelper>();

            securityTestHelper.PopulatePermissions();
            securityTestHelper.CreateAndSignInSuperAdmin();

            var brandHelper = Container.Resolve <BrandTestHelper>();
            var brand       = brandHelper.CreateActiveBrandWithProducts();

            var player = Container.Resolve <PlayerTestHelper>().CreatePlayer();

            _paymentTestHelper.CreatePlayerBankAccount(player.Id, brand.Id, true);

            _player = _playerQueries.GetPlayers().ToList().First();

            _observedWithdrawalId = Guid.NewGuid();
        }
Beispiel #2
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            _withdrawalService = Container.Resolve <IWithdrawalService>();
            _playerQueries     = Container.Resolve <PlayerQueries>();
            _paymentRepository = Container.Resolve <FakePaymentRepository>();
            _actorInfoProvider = Container.Resolve <IActorInfoProvider>();
            _paymentTestHelper = Container.Resolve <PaymentTestHelper>();
            _gamesTestHelper   = Container.Resolve <GamesTestHelper>();
            _walletQueries     = Container.Resolve <IWalletQueries>();
            _walletRepository  = Container.Resolve <GameRepository>();

            var securityTestHelper = Container.Resolve <SecurityTestHelper>();

            securityTestHelper.PopulatePermissions();
            securityTestHelper.CreateAndSignInSuperAdmin();

            Container.Resolve <PaymentWorker>().Start();

            var brandHelper = Container.Resolve <BrandTestHelper>();
            var brand       = brandHelper.CreateActiveBrandWithProducts();

            var player = Container.Resolve <PlayerTestHelper>().CreatePlayer();

            _paymentTestHelper.CreatePlayerBankAccount(player.Id, brand.Id, true);
        }
Beispiel #3
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            Balance = new BonusBalance();
            var bonusApiMock = new Mock <IBonusApiProxy>();

            bonusApiMock.Setup(proxy => proxy.GetPlayerBalanceAsync(It.IsAny <Guid>(), It.IsAny <Guid?>())).ReturnsAsync(Balance);
            Container.RegisterInstance(bonusApiMock.Object);

            Container.Resolve <PaymentWorker>().Start();
            _withdrawalService = Container.Resolve <IWithdrawalService>();
            _paymentRepository = Container.Resolve <FakePaymentRepository>();
            _actorInfoProvider = Container.Resolve <IActorInfoProvider>();

            _paymentRepository.Brands.Add(new Core.Payment.Data.Brand
            {
                Id         = DefaultBrandId,
                Name       = DefaultBrandId.ToString(),
                Code       = "138",
                TimezoneId = "Pacific Standard Time"
            });

            _paymentRepository.Banks.Add(new Bank
            {
                Id       = Guid.NewGuid(),
                BrandId  = DefaultBrandId,
                BankName = "138Bank"
            });
        }
        public override void BeforeEach()
        {
            base.BeforeEach();

            BonusBalance = new BonusBalance {
                Main = 10
            };
            var bonusApiMock = new Mock <IBonusApiProxy>();

            bonusApiMock.Setup(proxy => proxy.GetPlayerBalanceAsync(It.IsAny <Guid>(), It.IsAny <Guid?>())).ReturnsAsync(BonusBalance);
            Container.RegisterInstance(bonusApiMock.Object);

            Container.Resolve <PaymentWorker>().Start();
            var brandTestHelper    = Container.Resolve <BrandTestHelper>();
            var securityTestHelper = Container.Resolve <SecurityTestHelper>();

            securityTestHelper.PopulatePermissions();
            securityTestHelper.CreateAndSignInSuperAdmin();
            _brand = brandTestHelper.CreateBrand(isActive: true);

            var player = Container.Resolve <PlayerTestHelper>().CreatePlayer(true, _brand.Id);

            _playerId          = player.Id;
            _walletTemplateId  = _brand.WalletTemplates.Single(x => x.IsMain).Id;
            _validationService = Container.Resolve <ITransferFundValidationService>();
            _repository        = Container.Resolve <FakePaymentRepository>();

            _transferFundTestHelper = Container.Resolve <TransferFundTestHelper>();
            _paymentTestHelper      = Container.Resolve <PaymentTestHelper>();
        }
Beispiel #5
0
        public override void BeforeEach()
        {
            base.BeforeEach();
            _withdrawalService = Container.Resolve <IWithdrawalService>();
            Balance            = new BonusBalance();
            var bonusApiMock = new Mock <IBonusApiProxy>();

            bonusApiMock.Setup(proxy => proxy.GetPlayerBalanceAsync(It.IsAny <Guid>(), It.IsAny <Guid?>())).ReturnsAsync(Balance);
            Container.RegisterInstance(bonusApiMock.Object);
            _playerQueries     = Container.Resolve <PlayerQueries>();
            _paymentRepository = Container.Resolve <FakePaymentRepository>();
            Container.Resolve <PaymentWorker>().Start();

            _paymentTestHelper        = Container.Resolve <PaymentTestHelper>();
            _avcConfigurationCommands = Container.Resolve <IAVCConfigurationCommands>();
            _brandQueries             = Container.Resolve <BrandQueries>();

            var securityTestHelper = Container.Resolve <SecurityTestHelper>();

            securityTestHelper.PopulatePermissions();
            securityTestHelper.CreateAndSignInSuperAdmin();

            var brandHelper = Container.Resolve <BrandTestHelper>();
            var brand       = brandHelper.CreateActiveBrandWithProducts();

            var player = Container.Resolve <PlayerTestHelper>().CreatePlayer();

            player.DateRegistered = DateTimeOffset.Now.AddMonths(-1);
            _paymentTestHelper.CreatePlayerBankAccount(player.Id, brand.Id, true);
        }
        public void EmptyRepoReturnsNulls()
        {
            var repo = new FakePaymentRepository();

            var item = repo.GetPaymentById(Guid.NewGuid());

            Assert.That(item, Is.Null);
        }
        public override void BeforeEach()
        {
            base.BeforeEach();

            Balance = new BonusBalance();
            var bonusApiMock = new Mock <IBonusApiProxy>();

            bonusApiMock.Setup(proxy => proxy.GetPlayerBalanceAsync(It.IsAny <Guid>(), It.IsAny <Guid?>())).ReturnsAsync(Balance);
            Container.RegisterInstance(bonusApiMock.Object);

            _withdrawalService = Container.Resolve <IWithdrawalService>();
            _paymentRepository = Container.Resolve <FakePaymentRepository>();

            _gameRepository = Container.Resolve <FakeGameRepository>();
            _gameRepository.SavedChanges += (s, e) =>
            {
                var allGameActions = _gameRepository.Rounds
                                     .SelectMany(o => o.GameActions);

                foreach (var gameAction in allGameActions)
                {
                    if (Enumerable.Any(_gameRepository.GameActions, o => o.Id == gameAction.Id))
                    {
                        continue;
                    }

                    gameAction.Round.Game = _gameRepository.Games
                                            .Single(o => o.Id == gameAction.Round.GameId);

                    _gameRepository.GameActions.Add(gameAction);
                }
            };

            _actorInfoProvider        = Container.Resolve <IActorInfoProvider>();
            _paymentTestHelper        = Container.Resolve <PaymentTestHelper>();
            _gamesTestHelper          = Container.Resolve <GamesTestHelper>();
            _avcConfigurationCommands = Container.Resolve <IAVCConfigurationCommands>();
            _brandQueries             = Container.Resolve <BrandQueries>();
            _fraudRepository          = Container.Resolve <IFraudRepository>();

            var securityTestHelper = Container.Resolve <SecurityTestHelper>();

            securityTestHelper.PopulatePermissions();
            securityTestHelper.CreateAndSignInSuperAdmin();
            Container.Resolve <RiskLevelWorker>().Start();
            Container.Resolve <PaymentWorker>().Start();
            var brandHelper = Container.Resolve <BrandTestHelper>();
            var brand       = brandHelper.CreateActiveBrandWithProducts();

            player = Container.Resolve <PlayerTestHelper>().CreatePlayer();
            var bankAccount = _paymentTestHelper.CreatePlayerBankAccount(player.Id, brand.Id, true);

            bankAccount.Player.DateRegistered = DateTimeOffset.Now.AddMonths(-1);
        }
        public void CanSaveAndRetrieve()
        {
            var repo    = new FakePaymentRepository();
            var newItem = BuildPaymentData();

            repo.Add(newItem);
            var retrievedItem = repo.GetPaymentById(newItem.Id);

            AssertDataEqual(retrievedItem, newItem);
            Assert.That(retrievedItem !.BankTransactionId, Is.Null);
        }
Beispiel #9
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            _paymentRepositoryMock = Container.Resolve <FakePaymentRepository>();
            _depositCommands       = Container.Resolve <IOnlineDepositCommands>();
            _depositQueries        = Container.Resolve <IOnlineDepositQueries>();
            _paymentTestHelper     = Container.Resolve <PaymentTestHelper>();
            _actorInfoProvider     = Container.Resolve <IActorInfoProvider>();

            //Add Testing Data
            GenerateTestingData();
        }
        public async Task TestReadChargeAsync()
        {
            FakePaymentRepository fakePaymentRepository = new FakePaymentRepository();
            //AffirmPaymentService affirmPaymentsService = new AffirmPaymentService(fakePaymentRepository);
            FakeContextAccessor httpContextAccessor = new FakeContextAccessor();

            httpContextAccessor.HttpContext.Request.Headers.Add(AffirmConstants.PrivateKeyHeader, PrivateKey);
            httpContextAccessor.HttpContext.Request.Headers.Add(AffirmConstants.PublicKeyHeader, PublicKey);
            //var routesController = new RoutesController(affirmPaymentsService);

            //IActionResult controllerResult = await routesController.ReadChargeAsync(PaymentId);

            //Assert.IsTrue(controllerResult is JsonResult);
        }
        public override void BeforeEach()
        {
            base.BeforeEach();

            Balance = new BonusBalance();
            var bonusApiMock = new Mock <IBonusApiProxy>();

            bonusApiMock.Setup(proxy => proxy.GetPlayerBalanceAsync(It.IsAny <Guid>(), It.IsAny <Guid?>())).ReturnsAsync(Balance);
            Container.RegisterInstance(bonusApiMock.Object);

            Container.Resolve <PaymentWorker>().Start();

            _withdrawalService = Container.Resolve <IWithdrawalService>();
            _playerQueries     = Container.Resolve <PlayerQueries>();
            _paymentRepository = Container.Resolve <FakePaymentRepository>();
            _paymentTestHelper = Container.Resolve <PaymentTestHelper>();
            _withdrawalVerificationLogsQueues = Container.Resolve <IWithdrawalVerificationLogsQueues>();
            _riskLevelQueries = Container.Resolve <IRiskLevelQueries>();

            var securityTestHelper = Container.Resolve <SecurityTestHelper>();

            securityTestHelper.PopulatePermissions();
            securityTestHelper.CreateAndSignInSuperAdmin();
            _gamesTestHelper = Container.Resolve <GamesTestHelper>();

            var brandHelper = Container.Resolve <BrandTestHelper>();
            var brand       = brandHelper.CreateActiveBrandWithProducts();

            _brandQueries = Container.Resolve <BrandQueries>();

            _actorInfoProvider = Container.Resolve <IActorInfoProvider>();

            _avcConfigurationCommands = Container.Resolve <IAVCConfigurationCommands>();
            _riskProfileCheckCommands = Container.Resolve <IRiskProfileCheckCommands>();

            var player = Container.Resolve <PlayerTestHelper>().CreatePlayer();

            _paymentTestHelper.CreatePlayerBankAccount(player.Id, brand.Id, true);
            _observedBrand = _brandQueries.GetBrands().First();

            brandHelper.CreateRiskLevel(_observedBrand.Id);

            //Replace with risk levels from fraud repository
            var availableRiskLevels = _riskLevelQueries.GetByBrand(_observedBrand.Id);

            _observedRiskLevel = availableRiskLevels.FirstOrDefault().Id;

            _riskLevelDifferentThanObserved = availableRiskLevels.First(rl => rl.Id != _observedRiskLevel).Id;
        }
        public void CanUpdate()
        {
            var repo              = new FakePaymentRepository();
            var newItem           = BuildPaymentData();
            var bankTransactionId = Guid.NewGuid();

            repo.Add(newItem);
            repo.Update(newItem.Id, bankTransactionId, PaymentStatus.Accepted);

            var retrievedItem = repo.GetPaymentById(newItem.Id);

            Assert.That(retrievedItem !.Id, Is.EqualTo(newItem.Id));
            Assert.That(retrievedItem.Status, Is.EqualTo(PaymentStatus.Accepted));
            Assert.That(retrievedItem.BankTransactionId, Is.EqualTo(bankTransactionId));
        }
        public override void BeforeEach()
        {
            base.BeforeEach();

            _playerQueries     = Container.Resolve <PlayerQueries>();
            _paymentRepository = Container.Resolve <FakePaymentRepository>();
            _paymentTestHelper = Container.Resolve <PaymentTestHelper>();
            _gamesTestHelper   = Container.Resolve <GamesTestHelper>();

            var securityTestHelper = Container.Resolve <SecurityTestHelper>();

            securityTestHelper.PopulatePermissions();
            securityTestHelper.CreateAndSignInSuperAdmin();

            var brandHelper = Container.Resolve <BrandTestHelper>();

            brandHelper.CreateActiveBrandWithProducts();

            Container.Resolve <PlayerTestHelper>().CreatePlayer();
            Container.Resolve <PaymentWorker>().Start();
        }
        public void FailingBankHasDataInRepository()
        {
            var failingBank = new Mock <IAquiringBankService>();

            failingBank.Setup(r => r.ProcessPayment(It.IsAny <PaymentRequest>()))
            .ThrowsAsync(new InvalidOperationException("fail"));

            var paymentsRepo = new FakePaymentRepository();

            var service = new PaymentService(failingBank.Object,
                                             paymentsRepo,
                                             NullLogger <PaymentService> .Instance);

            var request = PaymentRequestBuilder.ValidPaymentRequest();

            Assert.ThrowsAsync <InvalidOperationException>(() => service.ProcessPayment(request));

            var savedItem = paymentsRepo.AllData().FirstOrDefault();

            Assert.That(savedItem, Is.Not.Null);
            Assert.That(savedItem.Status, Is.EqualTo(PaymentStatus.Received));
            Assert.That(savedItem.BankTransactionId, Is.Null);
        }
        public override void BeforeEach()
        {
            base.BeforeEach();

            mockAwcChec = new Mock <IAWCValidationService>();
            Container.RegisterInstance(mockAwcChec.Object);
            mockBonusWageringCheck = new Mock <IBonusWageringWithdrawalValidationService>();
            Container.RegisterInstance(mockBonusWageringCheck.Object);
            mockPaymentSettingsCheck = new Mock <IPaymentSettingsValidationService>();
            Container.RegisterInstance(mockPaymentSettingsCheck.Object);
            mockManualAdjWageringCheck = new Mock <IManualAdjustmentWageringValidationService>();
            Container.RegisterInstance(mockManualAdjWageringCheck.Object);
            mockRebateValidationCheck = new Mock <IRebateWageringValidationService>();
            Container.RegisterInstance(mockRebateValidationCheck.Object);
            mockFundsValidationCheck = new Mock <IFundsValidationService>();
            Container.RegisterInstance(mockFundsValidationCheck.Object);
            _withdrawalService = Container.Resolve <IWithdrawalService>();
            _playerQueries     = Container.Resolve <PlayerQueries>();
            _paymentRepository = Container.Resolve <FakePaymentRepository>();
            _actorInfoProvider = Container.Resolve <IActorInfoProvider>();
            _paymentTestHelper = Container.Resolve <PaymentTestHelper>();
            _gamesTestHelper   = Container.Resolve <GamesTestHelper>();
            Container.Resolve <PaymentWorker>().Start();
            var securityTestHelper = Container.Resolve <SecurityTestHelper>();

            securityTestHelper.PopulatePermissions();
            securityTestHelper.CreateAndSignInSuperAdmin();

            var brandHelper = Container.Resolve <BrandTestHelper>();
            var brand       = brandHelper.CreateActiveBrandWithProducts();

            var player = Container.Resolve <PlayerTestHelper>().CreatePlayer();

            _paymentTestHelper.CreatePlayerBankAccount(player.Id, brand.Id, true);

            _player = _playerQueries.GetPlayers().ToList().First();
        }