Exemplo n.º 1
0
        public void Cannot_execute_WithdrawalService_without_permissions()
        {
            // Arrange
            LogWithNewAdmin(Modules.OfflineDepositRequests, Permissions.View);

            // Act
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.GetWithdrawalsForVerification());
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.GetWithdrawalsForAcceptance());
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.GetWithdrawalsForApproval());
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.GetWithdrawalsCanceled());
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.GetWithdrawalsFailedAutoWagerCheck());
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.GetWithdrawalsOnHold());
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.Request(new OfflineWithdrawRequest()));
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.Verify(new Guid(), "Some remark"));
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.Unverify(new Guid(), "Some remark"));
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.Approve(new Guid(), "Some remark"));
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.Reject(new Guid(), "Some remark"));
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.PassWager(new Guid(), "Some remark"));
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.FailWager(new Guid(), "Some remark"));
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.PassInvestigation(new Guid(), "Some remark"));
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.FailInvestigation(new Guid(), "Some remark"));
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.Accept(new Guid(), "Some remark"));
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.Revert(new Guid(), "Some remark"));
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.Cancel(new Guid(), "Some remark"));
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.SaveExemption(new Exemption()));
        }
Exemplo n.º 2
0
        public IHttpActionResult SubmitExemption(Exemption exemption)
        {
            VerifyPermission(Permissions.Exempt, Modules.OfflineWithdrawalExemption);

            if (!ModelState.IsValid)
            {
                return(Ok(ErrorResponse()));
            }

            _withdrawalService.SaveExemption(exemption);

            return(Ok(new { Result = "success" }));
        }
Exemplo n.º 3
0
        public void Withdrawal_goes_directly_to_acceptance_queue_after_exemption_applied()
        {
            var brandId    = _brandQueries.GetBrands().First().Id;
            var licenseeId = _brandQueries.GetBrands().First().Licensee.Id;
            var currency   = _brandQueries.GetBrands().First().DefaultCurrency;
            var vipLevelId = (Guid)_brandQueries.GetBrands().First().DefaultVipLevelId;
            var playerId   = new Guid();

            var playersAffectedByAvc = _playerQueries.GetPlayers()
                                       .Where(player => player.BrandId == brandId &&
                                              player.Brand.LicenseeId == licenseeId &&
                                              player.CurrencyCode == currency &&
                                              player.VipLevelId == vipLevelId);

            if (playersAffectedByAvc.Any())
            {
                playerId = playersAffectedByAvc.FirstOrDefault().Id;
            }

            //Create a new avc that has a withdrawal exemption
            CreateAvcConfiguration(new AVCConfigurationDTO
            {
                Licensee  = licenseeId,
                Brand     = brandId,
                Currency  = currency,
                VipLevels = new[] { vipLevelId },

                HasWithdrawalExemption = true,

                HasWithdrawalCount           = true,
                TotalWithdrawalCountAmount   = 85,
                TotalWithdrawalCountOperator = ComparisonEnum.Greater,

                Status = AutoVerificationCheckStatus.Active
            });

            _paymentTestHelper.MakeDeposit(playerId, 1000);
            Balance.Main = 1000;

            //Setup an exemption for a particular player that will make a withdrawal request later in the test case.
            var playerExemption = new Exemption
            {
                Exempt      = true,
                ExemptFrom  = DateTime.UtcNow.AddDays(-2).ToString(CultureInfo.InvariantCulture),
                ExemptTo    = DateTime.UtcNow.AddDays(2).ToString(CultureInfo.InvariantCulture),
                ExemptLimit = 1,

                PlayerId = playerId
            };

            _withdrawalService.SaveExemption(playerExemption);

            //Create the offline withdrawal request
            MakeWithdrawalRequest(playerId, playersAffectedByAvc);

            var numberOfVerifiedWithdrawals = _withdrawalService
                                              .GetWithdrawalsVerified().Count(wd => wd.PlayerBankAccount.Player.Id == playerId);

            Assert.AreEqual(1, numberOfVerifiedWithdrawals);

            //Since we are allowed to only one exemption, this means that on the next withdrawal
            //we must have our withdrawal request in the verification queue but not in the acceptance queue
            MakeWithdrawalRequest(playerId, playersAffectedByAvc);
            Assert.AreEqual(1, numberOfVerifiedWithdrawals);
        }