示例#1
0
        public void Cannot_create_OW_request_exceeding_transaction_limit()
        {
            var paymentSettings = new PaymentSettings
            {
                Id                      = new Guid("50797305-5320-4086-BA1C-9D062DDF53D9"),
                BrandId                 = _player.BrandId,
                VipLevel                = _player.VipLevel.Id.ToString(),
                CurrencyCode            = _player.CurrencyCode,
                MinAmountPerTransaction = 10,
                MaxAmountPerTransaction = 20,
                MaxAmountPerDay         = 30,
                MaxTransactionPerDay    = 40,
                MaxTransactionPerWeek   = 50,
                MaxTransactionPerMonth  = 60
            };

            _paymentRepository.PaymentSettings.Add(paymentSettings);

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 21,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == _player.Id)
                                      .Id,
                Remarks     = "asd",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            var response = _withdrawalService.Request(offlineWithdrawalRequest);
        }
示例#2
0
        public async Task Can_create_OW_request()
        {
            _paymentTestHelper.MakeDeposit(_player.Id, 1000);
            await _gamesTestHelper.PlaceAndWinBet(1000, 10000, _player.Id);

            Balance.Main = 10000;

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == _player.Id)
                                      .Id,
                Remarks     = "asd",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            var response = _withdrawalService.Request(offlineWithdrawalRequest);

            var requests = _paymentRepository.OfflineWithdraws.ToList();

            Assert.IsNotEmpty(requests);

            var withdrawLockBalance = _paymentQueries.GetWithdrawalLockBalance(_player.Id);

            withdrawLockBalance.Should().Be(1);

            _paymentTestHelper.AssertBalance(_player.Id
                                             , total: 10000, playable: 9999, main: 9999, free: 9999, withdrawalLock: 1);
        }
示例#3
0
        public async Task Can_withhold_withdrawal_money()
        {
            var player = _playerQueries.GetPlayers().ToList().First();

            _paymentTestHelper.MakeDeposit(player.Id, 1000);
            await _gamesTestHelper.PlaceAndWinBet(1000, 1100, player.Id);

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1000,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == player.Id)
                                      .Id,
                Remarks     = "asd",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            _withdrawalService.Request(offlineWithdrawalRequest);

            var playerBalance = await _walletQueries.GetPlayerBalance(player.Id);

            Assert.AreEqual(100, playerBalance.Free);
            Assert.AreEqual(1000, playerBalance.WithdrawalLock);
        }
        public void Validate(OfflineWithdrawRequest request)
        {
            var bankAccount = _paymentRepository.PlayerBankAccounts.Include(x => x.Player).FirstOrDefault(x => x.Id == request.PlayerBankAccountId);

            var brandId  = bankAccount.Player.BrandId;
            var currency = bankAccount.Player.CurrencyCode;

            var wagerConfiguration = _fraudRepository
                                     .WagerConfigurations
                                     .Where(
                x =>
                x.BrandId == brandId &&
                (x.IsServeAllCurrencies || x.CurrencyCode == currency) &&
                x.IsDepositWageringCheck &&
                x.IsActive);

            if (!wagerConfiguration.Any())
            {
                return;
            }

            var deposits = _paymentRepository.OfflineDeposits.Include(x => x.Player).Where(x => x.Player.Id == bankAccount.Player.Id && x.Status == OfflineDepositStatus.Approved);

            if (deposits.Any(x => x.DepositWagering != 0))
            {
                throw new AutoWagerCheckException();
            }
        }
示例#5
0
        public void Cannot_create_OWs_more_than_transaction_limit_per_week()
        {
            const int transactionPerWeek = 10;
            var       player             = _player;
            var       paymentSettings    = new PaymentSettings
            {
                Id                      = new Guid("50797305-5320-4086-BA1C-9D062DDF53D9"),
                BrandId                 = player.BrandId,
                VipLevel                = player.VipLevel.Id.ToString(),
                CurrencyCode            = player.CurrencyCode,
                MinAmountPerTransaction = -10,
                MaxAmountPerTransaction = 100,
                MaxAmountPerDay         = 100,
                MaxTransactionPerDay    = 100,
                MaxTransactionPerWeek   = transactionPerWeek,
                MaxTransactionPerMonth  = 60
            };

            _paymentRepository.PaymentSettings.Add(paymentSettings);

            for (int i = 0; i < 10; i++)
            {
                var offlineWithdrawalRequest = new OfflineWithdrawRequest
                {
                    Amount              = 1,
                    NotificationType    = NotificationType.None,
                    BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                    BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                    PlayerBankAccountId = _paymentRepository
                                          .PlayerBankAccounts
                                          .Include(x => x.Player)
                                          .First(x => x.Player.Id == player.Id)
                                          .Id,
                    Remarks     = "asd",
                    RequestedBy = _actorInfoProvider.Actor.UserName
                };

                _withdrawalService.Request(offlineWithdrawalRequest);
            }

            var lastRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == player.Id)
                                      .Id,
                Remarks     = "asd",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            var response = _withdrawalService.Request(lastRequest);
        }
        public async Task Validate(OfflineWithdrawRequest request)
        {
            await _fundsValidationService.Validate(request);

            foreach (var withdrawalValidationService in _withdrawalValidationServices)
            {
                withdrawalValidationService.Validate(request);
            }
        }
        public async Task Can_create_ow_with_total_withdrawal_amount_greater_than_setted_up()
        {
            var brand = _brandQueries.GetBrands().First();

            CreateAvcConfiguration(
                new AVCConfigurationDTO
            {
                Brand                        = brand.Id,
                VipLevels                    = new[] { brand.DefaultVipLevelId.Value },
                Currency                     = brand.DefaultCurrency,
                HasFraudRiskLevel            = false,
                HasWithdrawalCount           = true,
                TotalWithdrawalCountAmount   = 1,
                TotalWithdrawalCountOperator = ComparisonEnum.Greater
            }
                );

            _paymentRepository.OfflineWithdraws.Add(new OfflineWithdraw
            {
                Id                = Guid.NewGuid(),
                Amount            = 20,
                Status            = WithdrawalStatus.Approved,
                PlayerBankAccount = _paymentRepository.PlayerBankAccounts.Include(x => x.Player).First(x => x.Player.Id == player.Id)
            });
            _paymentRepository.OfflineWithdraws.Add(new OfflineWithdraw
            {
                Id                = Guid.NewGuid(),
                Amount            = 20,
                Status            = WithdrawalStatus.Approved,
                PlayerBankAccount = _paymentRepository.PlayerBankAccounts.Include(x => x.Player).First(x => x.Player.Id == player.Id)
            });

            _paymentRepository.SaveChanges();
            _paymentTestHelper.MakeDeposit(player.Id, 1000);
            await _gamesTestHelper.PlaceAndWinBet(1000, 10000, player.Id);

            Balance.Main = 10000;
            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == player.Id)
                                      .Id,
                Remarks     = "asd",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            var response = _withdrawalService.Request(offlineWithdrawalRequest);

            Assert.IsNotNull(response.Id);
        }
        public async void Validate(OfflineWithdrawRequest request)
        {
            var bankAccount = _paymentRepository.PlayerBankAccounts.Include(x => x.Player).First(x => x.Id == request.PlayerBankAccountId);

            var wageringBalances = await _bonusApiProxy.GetWageringBalancesAsync(bankAccount.Player.Id);

            if (wageringBalances.Remaining > 0)
            {
                throw new BonusWageringValidationException();
            }
        }
        private void AssertRiskProfileCheckStatus(OfflineWithdrawRequest offlineWithdrawalRequest,
                                                  Core.Brand.Interface.Data.Brand brand, FraudRiskLevelStatus expectedResult)
        {
            var response = _withdrawalService.Request(offlineWithdrawalRequest);

            var riskProfileCheckReportInfo = _withdrawalVerificationLogsQueues.RiskProfileCheckStatus(response.Id,
                                                                                                      brand.Name, brand.Licensee.Name, "Random Name");

            Assert.AreEqual(expectedResult.ToString(),
                            riskProfileCheckReportInfo.VerificationDialogHeaderValues.StatusSuccess);
        }
        public async void Win_Loss_rule_is_interpreted_in_oposite_manner_between_AVC_and_RPC(ComparisonEnum comparison, FraudRiskLevelStatus status)
        {
            var playerId = new Guid();

            playerId = PickAPlayer(playerId);

            CreateAvcConfiguration(new AVCConfigurationDTO
            {
                Licensee  = _observedBrand.LicenseeId,
                Brand     = _observedBrand.Id,
                Currency  = _observedBrand.DefaultCurrency,
                VipLevels = new[] { (Guid)_observedBrand.DefaultVipLevelId },

                HasWinLoss      = true,
                WinLossAmount   = 5,
                WinLossOperator = ComparisonEnum.Greater,

                Status = AutoVerificationCheckStatus.Active
            });

            _riskProfileCheckCommands.Create(new RiskProfileCheckDTO
            {
                Licensee  = _observedBrand.LicenseeId,
                Brand     = _observedBrand.Id,
                Currency  = _observedBrand.DefaultCurrency,
                VipLevels = new[] { (Guid)_observedBrand.DefaultVipLevelId },

                HasWinLoss      = true,
                WinLossAmount   = 5,
                WinLossOperator = comparison,
            });

            await DepositBetAndWin(playerId);

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == playerId)
                                      .Id,
                Remarks     = "asd",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            AssertRiskProfileCheckStatus(offlineWithdrawalRequest,
                                         _observedBrand,
                                         status);
        }
        public async Task Can_not_make_ow_when_has_winning_amount_less_than_setted_up()
        {
            var brand          = _brandQueries.GetBrands().First();
            var externalGameId = _gamesTestHelper.GetMainWalletExternalGameId(player.Id);
            var providerId     = _gameRepository.Games.Single(x => x.ExternalId == externalGameId).GameProviderId;

            CreateAvcConfiguration(
                new AVCConfigurationDTO
            {
                Brand             = brand.Id,
                VipLevels         = new[] { brand.DefaultVipLevelId.Value },
                Currency          = brand.DefaultCurrency,
                HasFraudRiskLevel = false,
                HasWinnings       = true,
                WinningRules      = new List <WinningRuleDTO>
                {
                    FraudTestDataHelper.GenerateWinningRule(providerId)
                },
                Status = AutoVerificationCheckStatus.Active
            }
                );

            _paymentTestHelper.MakeDeposit(player.Id, 100);

            await _gamesTestHelper.PlaceAndWinBet(100, 99, player.Id);

            Balance.Main = 99;

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == player.Id)
                                      .Id,
                Remarks     = "rogi",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            _withdrawalService.Request(offlineWithdrawalRequest);

            var isHasWinningsFailed = _fraudRepository.WithdrawalVerificationLogs.Any(
                o => o.VerificationStep == VerificationStep.HasWinnings &&
                !o.IsSuccess);

            Assert.IsTrue(isHasWinningsFailed);
        }
示例#12
0
        public async Task Validate(OfflineWithdrawRequest request)
        {
            var bankAccount =
                _paymentRepository
                .PlayerBankAccounts
                .Include(x => x.Player)
                .FirstOrDefault(x => x.Id == request.PlayerBankAccountId);

            var wallet = await _walletQueries.GetPlayerBalance(bankAccount.Player.Id);

            if (wallet.Free < request.Amount)
            {
                throw new NotEnoughFundsException();
            }
        }
        private async Task ValidateRiskLevelCriteriaCheck(Guid riskLevelForRpc, FraudRiskLevelStatus expectedResult)
        {
            var playerId = new Guid();

            playerId = PickAPlayer(playerId);

            CreateAvcConfiguration(new AVCConfigurationDTO
            {
                Licensee          = _observedBrand.LicenseeId,
                Brand             = _observedBrand.Id,
                Currency          = _observedBrand.DefaultCurrency,
                VipLevels         = new[] { (Guid)_observedBrand.DefaultVipLevelId },
                HasFraudRiskLevel = true,
                RiskLevels        = new[] { _observedRiskLevel },
                Status            = AutoVerificationCheckStatus.Active
            });

            _riskProfileCheckCommands.Create(new RiskProfileCheckDTO
            {
                Licensee          = _observedBrand.LicenseeId,
                Brand             = _observedBrand.Id,
                Currency          = _observedBrand.DefaultCurrency,
                VipLevels         = new[] { (Guid)_observedBrand.DefaultVipLevelId },
                HasFraudRiskLevel = true,
                RiskLevels        = new[] { riskLevelForRpc },
            });

            await DepositBetAndWin(playerId);

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == playerId)
                                      .Id,
                Remarks     = "asd",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            AssertRiskProfileCheckStatus(offlineWithdrawalRequest,
                                         _observedBrand,
                                         expectedResult);
        }
        public async Task Can_not_create_ow_with_deposit_count_greater_than_setted_up()
        {
            var brand = _brandQueries.GetBrands().First();

            CreateAvcConfiguration(
                new AVCConfigurationDTO
            {
                Brand                     = brand.Id,
                VipLevels                 = new[] { brand.DefaultVipLevelId.Value },
                Currency                  = brand.DefaultCurrency,
                HasFraudRiskLevel         = false,
                HasDepositCount           = true,
                TotalDepositCountAmount   = 6,
                TotalDepositCountOperator = ComparisonEnum.Greater,
                Status                    = AutoVerificationCheckStatus.Active
            }
                );

            _paymentTestHelper.MakeDeposit(player.Id, 1000);
            _paymentTestHelper.MakeDeposit(player.Id, 1000);
            await _gamesTestHelper.PlaceAndWinBet(1000, 10000, player.Id);

            Balance.Main = 11000;

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == player.Id)
                                      .Id,
                Remarks     = "asd",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            _withdrawalService.Request(offlineWithdrawalRequest);

            var depositCountFailed = _fraudRepository.WithdrawalVerificationLogs.Any(
                o => o.VerificationStep == VerificationStep.DepositCount &&
                !o.IsSuccess);

            Assert.IsTrue(depositCountFailed);
        }
示例#15
0
        public OfflineWithdrawalResponse OfflineWithdraw(WithdrawalRequest request)
        {
            ValidateAccountFrozenStatus();

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                PlayerId            = PlayerId,
                Amount              = request.Amount,
                PlayerBankAccountId = _paymentQueries.GetPlayer(PlayerId).CurrentBankAccount.Id,
                RequestedBy         = Username,
                NotificationType    = request.NotificationType,
            };

            _withdrawalService.Request(offlineWithdrawalRequest);

            return(new OfflineWithdrawalResponse());
        }
示例#16
0
        public async Task Cannot_create_OW_with_auto_wager_check()
        {
            var wagerId = _wageringConfigurationCommands.CreateWagerConfiguration(new WagerConfigurationDTO()
            {
                BrandId = _player.BrandId,
                IsDepositWageringCheck = true,
                Currency = _player.CurrencyCode
            }, Guid.NewGuid());

            _wageringConfigurationCommands.ActivateWagerConfiguration(wagerId, Guid.NewGuid());
            //Make deposit
            _paymentTestHelper.MakeDeposit(_player.Id, 200);
            //Make bet
            await _gamesTestHelper.PlaceAndWinBet(20, 10000, _player.Id);

            await _gamesTestHelper.PlaceAndWinBet(20, 10000, _player.Id);

            await _gamesTestHelper.PlaceAndWinBet(50, 10000, _player.Id);

            //Make one more deposit
            _paymentTestHelper.MakeDeposit(_player.Id, 100);

            //Bet one more
            await _gamesTestHelper.PlaceAndWinBet(20, 10000, _player.Id);

            Balance.Main = 40190;

            _walletRepository.SaveChanges();

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == _player.Id)
                                      .Id,
                Remarks     = "asd",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            var response = _withdrawalService.Request(offlineWithdrawalRequest);
        }
示例#17
0
        private OfflineWithdrawResponse MakeWithdrawalRequest(Guid playerId, IQueryable <Core.Common.Data.Player.Player> playersAffectedByAvc)
        {
            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts.
                                      Include(x => x.Player).
                                      First(x => x.Player.Id == playerId)
                                      .Id,
                Remarks     = "rogi",
                RequestedBy = playersAffectedByAvc.FirstOrDefault().Username
            };

            return(_withdrawalService.Request(offlineWithdrawalRequest));
        }
示例#18
0
        public void Cannot_request_offline_withdraw_with_invalid_brand()
        {
            // Arrange
            var playerBankAccount = CreateNewPlayerBankAccount(DefaultBrandId);

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = playerBankAccount.Id,
                Remarks             = "asd",
                RequestedBy         = _actorInfoProvider.Actor.UserName
            };

            LogWithNewAdmin(Modules.OfflineWithdrawalRequest, Permissions.Create);

            // Act
            Assert.Throws <InsufficientPermissionsException>(() => _withdrawalService.Request(offlineWithdrawalRequest));
        }
示例#19
0
        public OfflineWithdrawResponse WithdrawalRequestSubmit(OfflineWithdrawRequest request)
        {
            var offlineWithdrawResponse           = new OfflineWithdrawResponse();
            var offlineWithdrawalRequestValidator =
                new OfflineWithdrawalRequestValidator(_container, _repository);

            var validationResult = offlineWithdrawalRequestValidator.Validate(request);

            if (!validationResult.IsValid)
            {
                throw new RegoValidationException(validationResult);
            }

            var bankAccount =
                _repository.PlayerBankAccounts.Include(y => y.Player)
                .Include(y => y.Bank)
                .Include(y => y.Player.Brand)
                .SingleOrDefault(y => y.Id == request.PlayerBankAccountId);

            var id = offlineWithdrawResponse.Id = Guid.NewGuid();

            var referenceCode = GenerateTransactionNumber();

            _serviceBus.PublishMessage(
                new WithdrawRequestSubmit
            {
                ActorName           = _actorInfoProvider.Actor.UserName,
                WithdrawId          = id,
                PlayerId            = bankAccount.Player.Id,
                Amount              = request.Amount,
                LockId              = Guid.NewGuid(),
                PlayerBankAccountId = request.PlayerBankAccountId,
                ReferenceCode       = referenceCode,
                RequestedBy         = request.RequestedBy,
                Requested           = DateTimeOffset.Now.ToBrandOffset(bankAccount.Player.Brand.TimezoneId),
                Remarks             = request.Remarks
            });

            return(offlineWithdrawResponse);
        }
        public string Create(OfflineWithdrawRequest withdrawRequest)
        {
            if (ModelState.IsValid == false)
            {
                return(SerializeJson(new { Result = "failed", Data = (string)null }));
            }

            withdrawRequest.RequestedBy = System.Threading.Thread.CurrentPrincipal.Identity.Name;

            OfflineWithdrawResponse response;

            try
            {
                response = _service.Request(withdrawRequest);
            }
            catch (Exception ex)
            {
                return(SerializeJson(new { Result = "failed", Error = ex.Message }));
            }

            return(SerializeJson(new { Result = "success", Data = "app:payment.withdraw.requestCreated", Id = response.Id }));
        }
        public void Validate(OfflineWithdrawRequest request)
        {
            var bankAccount = _paymentRepository.PlayerBankAccounts.Include(x => x.Player).FirstOrDefault(x => x.Id == request.PlayerBankAccountId);

            var brandId  = bankAccount.Player.BrandId;
            var currency = bankAccount.Player.CurrencyCode;

            var wagerConfiguration = _fraudRepository
                                     .WagerConfigurations
                                     .Where(
                x =>
                x.BrandId == brandId &&
                (x.IsServeAllCurrencies || x.CurrencyCode == currency) &&
                x.IsManualAdjustmentWageringCheck &&
                x.IsActive);

            if (!wagerConfiguration.Any())
            {
                return;
            }

            return;
        }
示例#22
0
        public ValidationResult ValidateWithdrawalRequest(WithdrawalRequest request)
        {
            var player = _paymentQueries.GetPlayer(PlayerId);

            if (player == null)
            {
                throw new RegoException(ErrorMessagesEnum.ServiceUnavailable.ToString());
            }

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                PlayerId            = PlayerId,
                Amount              = request.Amount,
                PlayerBankAccountId = player.CurrentBankAccount.Id,
                RequestedBy         = Username,
                NotificationType    = request.NotificationType,
            };
            var errors = new Dictionary <string, string>();

            try
            {
                var result = _paymentQueries.ValidateOfflineWithdrawalRequest(offlineWithdrawalRequest);

                if (result.Errors.Any())
                {
                    result.Errors.ForEach(x => errors.Add(x.PropertyName, x.ErrorMessage));
                }
            }
            catch (RegoValidationException regoValidationException)
            {
                errors.Add("Amount", regoValidationException.Message);
            }
            return(new ValidationResult
            {
                Errors = errors
            });
        }
示例#23
0
        private Guid CreateOfflineWithdraw()
        {
            var paymentTestHelper = Container.Resolve <PaymentTestHelper>();

            var playerBankAccount = CreateNewPlayerBankAccount(DefaultBrandId);

            paymentTestHelper.MakeDeposit(playerBankAccount.Player.Id, 1000);
            Balance.Main = 1000;

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = playerBankAccount.Id,
                Remarks             = "asd",
                RequestedBy         = _actorInfoProvider.Actor.UserName
            };

            var offlineWithdrawalResponse = _withdrawalService.Request(offlineWithdrawalRequest);

            return(offlineWithdrawalResponse.Id);
        }
示例#24
0
        public async Task Can_create_OW_with_1x_auto_wager_check()
        {
            //Make deposit
            _paymentTestHelper.MakeDeposit(_player.Id, 100);

            //Make bet
            await _gamesTestHelper.PlaceAndWinBet(20, 20, _player.Id);

            await _gamesTestHelper.PlaceAndWinBet(30, 30, _player.Id);

            await _gamesTestHelper.PlaceAndWinBet(50, 100, _player.Id);

            Balance.Main = 150;

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == _player.Id)
                                      .Id,
                Remarks     = "asd",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            var response = _withdrawalService.Request(offlineWithdrawalRequest);

            response.Should().NotBeNull();

            _paymentTestHelper.AssertBalance(_player.Id
                                             , total: 150, playable: 149, main: 149, free: 149, withdrawalLock: 1);
        }
        private async Task CreateOWR()
        {
            var player = _player;

            _paymentTestHelper.MakeDeposit(player.Id, 1000);
            await _gamesTestHelper.PlaceAndWinBet(1000, 10000, player.Id);

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == player.Id)
                                      .Id,
                Remarks     = "asd",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            _withdrawalService.Request(offlineWithdrawalRequest);
        }
示例#26
0
        public async Task Can_create_OW_with_1x_auto_wager_check_with_gap_between_deposits()
        {
            var player = _player;

            var wagerId = _wageringConfigurationCommands.CreateWagerConfiguration(new WagerConfigurationDTO()
            {
                BrandId = player.BrandId,
                IsDepositWageringCheck = true,
                Currency = player.CurrencyCode
            }, Guid.NewGuid());

            _wageringConfigurationCommands.ActivateWagerConfiguration(wagerId, Guid.NewGuid());
            //Make deposit
            _paymentTestHelper.MakeDeposit(player.Id, 1000);

            //Make bet
            await _gamesTestHelper.PlaceAndWinBet(500, 600, player.Id);

            await _gamesTestHelper.PlaceAndWinBet(300, 600, player.Id);

            await _gamesTestHelper.PlaceAndWinBet(200, 600, player.Id);

            await _gamesTestHelper.PlaceAndWinBet(500, 600, player.Id);

            await _gamesTestHelper.PlaceAndWinBet(50, 600, player.Id);

            await _gamesTestHelper.PlaceAndWinBet(300, 600, player.Id);

            Balance.Main = 2750;

            var offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 200,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == player.Id)
                                      .Id,
                Remarks     = "asd",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            _withdrawalService.Request(offlineWithdrawalRequest);

            //Make deposit
            _paymentTestHelper.MakeDeposit(player.Id, 500);

            //Make bet
            await _gamesTestHelper.PlaceAndWinBet(300, 600, player.Id);

            await _gamesTestHelper.PlaceAndWinBet(100, 600, player.Id);

            Balance.Main = 4050;

            offlineWithdrawalRequest = new OfflineWithdrawRequest
            {
                Amount              = 1,
                NotificationType    = NotificationType.None,
                BankAccountTime     = _paymentRepository.PlayerBankAccounts.First().Created.ToString(),
                BankTime            = _paymentRepository.Banks.First().Created.ToString(),
                PlayerBankAccountId = _paymentRepository
                                      .PlayerBankAccounts
                                      .Include(x => x.Player)
                                      .First(x => x.Player.Id == player.Id)
                                      .Id,
                Remarks     = "asd",
                RequestedBy = _actorInfoProvider.Actor.UserName
            };

            _withdrawalService.Request(offlineWithdrawalRequest);
        }
示例#27
0
        public ValidationResult ValidateOfflineWithdrawalRequest(OfflineWithdrawRequest data)
        {
            var offlineWithdrawalRequest = new OfflineWithdrawalRequestValidator(_container, _repository);

            return(offlineWithdrawalRequest.Validate(data));
        }
        public void Validate(OfflineWithdrawRequest request)
        {
            var bankAccount    = _paymentRepository.PlayerBankAccounts.Include(x => x.Player).FirstOrDefault(x => x.Id == request.PlayerBankAccountId);
            var paymentSetting = _paymentQueries.GetPaymentSetting(
                bankAccount.Player.BrandId,
                bankAccount.Player.CurrencyCode,
                _brandQueries.GetVipLevelViewModel(bankAccount.Player.VipLevelId),
                PaymentType.Withdraw);

            var allRequestsFromPlayer =
                _paymentRepository
                .OfflineWithdraws
                .Include(x => x.PlayerBankAccount)
                .Include(x => x.PlayerBankAccount.Player)
                .Where(x => x.PlayerBankAccount.Player.Id == bankAccount.Player.Id)
                .ToList();

            if (paymentSetting == null)
            {
                return;
            }
            //Verify amount per transaction
            if (request.Amount > paymentSetting.MaxAmountPerTransaction && paymentSetting.MaxAmountPerTransaction != 0)
            {
                throw new PaymentSettingsViolatedException("app:payment.settings.amountExceedsAllowedValueError", paymentSetting.MaxAmountPerTransaction);
            }

            if (request.Amount < paymentSetting.MinAmountPerTransaction && paymentSetting.MinAmountPerTransaction != 0)
            {
                throw new PaymentSettingsViolatedException("app:payment.settings.amountBelowAllowedValueError", paymentSetting.MinAmountPerTransaction);
            }

            //Verify amount per day
            decimal amount = 0;

            allRequestsFromPlayer
            .Where(x => x.Created.Date.CompareTo(DateTimeOffset.Now.Date) == 0)
            .ToList()
            .ForEach(x => amount += x.Amount);

            if (amount + request.Amount > paymentSetting.MaxAmountPerDay && paymentSetting.MaxAmountPerDay != 0)
            {
                throw new PaymentSettingsViolatedException("app:payment.settings.amountExceedsDailyLimitError", amount + request.Amount);
            }

            //Verify transactions per day
            var transactionsPerDayCount = allRequestsFromPlayer
                                          .Count(x => x.Created.Date.CompareTo(DateTimeOffset.Now.Date) == 0);

            if (transactionsPerDayCount + 1 > paymentSetting.MaxTransactionPerDay && paymentSetting.MaxTransactionPerDay != 0)
            {
                throw new PaymentSettingsViolatedException("app:payment.settings.numberTransactionsExceedsMonthLimitError", transactionsPerDayCount + 1);
            }

            //Verify transactions per week
            var transactionsPerWeekCount = allRequestsFromPlayer
                                           .Count(x => (x.Created - DateTimeOffset.Now).TotalDays <= 7);

            if (transactionsPerWeekCount + 1 > paymentSetting.MaxTransactionPerWeek && paymentSetting.MaxTransactionPerWeek != 0)
            {
                throw new PaymentSettingsViolatedException("app:payment.settings.numberTransactionsExceedsWeeklyLimitError", transactionsPerWeekCount + 1);
            }

            //Verify transactions per month
            var transactionsPerMonthCount = allRequestsFromPlayer
                                            .Count(x => x.Created.Date.Month == DateTimeOffset.Now.Month && x.Created.Date.Year == DateTimeOffset.Now.Year);

            if (transactionsPerMonthCount + 1 > paymentSetting.MaxTransactionPerMonth && paymentSetting.MaxTransactionPerMonth != 0)
            {
                throw new PaymentSettingsViolatedException("app:payment.settings.numberTransactionsExceedsMonthLimitError", transactionsPerMonthCount + 1);
            }
        }
示例#29
0
 public OfflineWithdrawResponse Request(OfflineWithdrawRequest request)
 {
     return(WithdrawalRequestSubmit(request));
 }