Ejemplo n.º 1
0
        public async Task Can_cancel_withdrawal_request()
        {
            var player = _player;

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

            Balance.Main = 10000;

            var response = _paymentTestHelper.MakeWithdraw(player.Id, _actorInfoProvider.Actor.UserName);

            _paymentTestHelper.AssertBalance(_player.Id
                                             , total: 10000, playable: 9999, main: 9999, free: 9999, withdrawalLock: 1);

            var cancelRemarkts = TestDataGenerator.GetRandomString(10);

            _withdrawalService.Cancel(response.Id, cancelRemarkts);
            var ow = _withdrawalService.GetWithdrawalsCanceled();

            Assert.IsNotEmpty(ow);
            Assert.AreEqual(1, ow.Count());

            _paymentTestHelper.AssertBalance(_player.Id
                                             , total: 10000, playable: 10000, main: 10000, free: 10000, withdrawalLock: 0);

            var withdraw = _paymentRepository.OfflineWithdraws.FirstOrDefault(x => x.Id == response.Id);

            withdraw.Status.Should().Be(WithdrawalStatus.Canceled);
            withdraw.CanceledTime.Should().BeCloseTo(DateTimeOffset.Now, 60000);
            withdraw.CanceledBy.Should().Be(_actorInfoProvider.Actor.UserName);
            withdraw.Remarks.Should().Be(cancelRemarkts);
        }
Ejemplo n.º 2
0
        private void CancelOfflineWithdrawalRequest(WithdrawalStatus stateToGetInto)
        {
            _paymentTestHelper.MakeDeposit(_player.Id, 2000);
            Balance.Main = 2000;

            var response = _paymentTestHelper.MakeWithdraw(_player.Id, amount: 100);

            _withdrawalService.Revert(response.Id, "Revert to Verification Queue");

            /*
             */
            //Cancel withdrawal request
            if (stateToGetInto == WithdrawalStatus.Canceled)
            {
                _withdrawalService.Cancel(response.Id, "Cancel Withdrawal Request");
            }
            else if (stateToGetInto == WithdrawalStatus.Unverified)
            {
                _withdrawalService.Unverify(response.Id, "Unverify Withdrawal Request");
            }

            //Assert there's nothing in the "On Hold Queue"
            var withdrawalsInTheOnHoldQueue = _withdrawalService.GetWithdrawalsOnHold();

            Assert.IsEmpty(withdrawalsInTheOnHoldQueue);

            //Assert there's nothing in the "Release Queue"
            var withdrawalsInTheReleaseQueue = _withdrawalService.GetWithdrawalsForApproval();

            Assert.IsEmpty(withdrawalsInTheReleaseQueue);

            //Assert there's nothing in the "Acceptance Queue"
            var withdrawalsInTheAccQueue = _withdrawalService.GetWithdrawalsForAcceptance();

            Assert.IsEmpty(withdrawalsInTheAccQueue);

            //Assert there's nothing in the "Verification Queue"
            var withdrawalsInTheVerificationQueue = _withdrawalService.GetWithdrawalsForVerificationQueue();

            Assert.IsEmpty(withdrawalsInTheVerificationQueue);
        }