Exemplo n.º 1
0
        private async Task <SubmitOnlineDepositRequestResult> SubmitOnlineDeposit(OnlineDepositRequest depositRequest)
        {
            var requestResult = await _onlineDepositCommands.SubmitOnlineDepositRequest(depositRequest);

            requestResult.Should().NotBeNull();
            requestResult.RedirectParams.Amount.Should().Be(depositRequest.Amount, "Amount");
            //keep transactionNumber
            _transactionNumber = requestResult.RedirectParams.OrderId;

            return(requestResult);
        }
Exemplo n.º 2
0
        public async void Can_submit_online_deposit_request()
        {
            var depositRequest = new OnlineDepositRequest
            {
                Amount      = 200,
                PlayerId    = _testPlayer.Id,
                RequestedBy = "Pl_QIOZZLVL4",
                BonusCode   = string.Empty,
                CultureCode = "en-US",
                NotifyUrl   = "http://localhost/notifyurl",
                ReturnUrl   = "http://localhost/returnurl",
            };

            var requestResult = await _depositCommands.SubmitOnlineDepositRequest(depositRequest);

            requestResult.RedirectUrl.Should().Be(new Uri(_testPaymentGatewaySettings.EntryPoint));
            requestResult.RedirectParams.Amount.Should().Be(depositRequest.Amount, "Amount");
            requestResult.RedirectParams.OrderId.Should().NotBeNullOrEmpty("OrderId");
            requestResult.RedirectParams.Channel.Should().Be(_testPaymentGatewaySettings.Channel);
            requestResult.RedirectParams.Method.Should().Be(_testPaymentGatewaySettings.PaymentGatewayName);
            requestResult.RedirectParams.Currency.Should().Be(_testPlayer.CurrencyCode, "Currency");
            requestResult.RedirectParams.Language.Should().Be("en-US", "Language");
            requestResult.RedirectParams.NotifyUrl.Should().Be(depositRequest.NotifyUrl);
            requestResult.RedirectParams.ReturnUrl.Should().Be(depositRequest.ReturnUrl);
            //TODO:ONLINEDEPOSIT
            requestResult.RedirectParams.MerchantId.Should().NotBeNullOrEmpty("MerchantId");
            requestResult.RedirectParams.Signature.Should().NotBeNullOrEmpty("Signature");
            var orderId = requestResult.RedirectParams.OrderId;

            var onlineDeposit = _paymentRepositoryMock.OnlineDeposits.OrderByDescending(x => x.Created).First();

            onlineDeposit.Should().NotBeNull();
            if (onlineDeposit != null)
            {
                onlineDeposit.Amount.Should().Be(depositRequest.Amount, "Amount");
                onlineDeposit.Status.Should().Be(OnlineDepositStatus.Processing, "Status");
                onlineDeposit.PlayerId.Should().Be(depositRequest.PlayerId, "PlayerId");
                onlineDeposit.CreatedBy.Should().Be(depositRequest.RequestedBy, "CreatedBy");
                onlineDeposit.TransactionNumber.Should().Be(orderId, "TransactionNumber");
                onlineDeposit.Method.Should().NotBeNullOrEmpty("Method");
                onlineDeposit.MerchantId.Should().NotBeNullOrEmpty("MerchantId");
                onlineDeposit.Language.Should().Be("en-US", "Language");
                onlineDeposit.Currency.Should().Be(_testPlayer.CurrencyCode, "Currency");
                onlineDeposit.ReturnUrl.Should().Be(depositRequest.ReturnUrl);
                onlineDeposit.NotifyUrl.Should().Be(depositRequest.NotifyUrl);
                onlineDeposit.OrderIdOfGateway.Should().BeNull("OrderIdOfGateway");
                onlineDeposit.OrderIdOfRouter.Should().BeNull("OrderIdOfRouter");
                onlineDeposit.BonusCode.Should().Be(depositRequest.BonusCode, "BonusCode");
            }
        }
Exemplo n.º 3
0
        public async Task <OnlineDepositResponse> SubmitOnlineDeposit(OnlineDepositRequest request)
        {
            var onlineDepositRequest = Mapper.DynamicMap <Core.Payment.Interface.Data.OnlineDepositRequest>(request);

            onlineDepositRequest.PlayerId    = PlayerId;
            onlineDepositRequest.RequestedBy = Username;

            var requestResult = await _onlineDepositCommands.SubmitOnlineDepositRequest(onlineDepositRequest);

            var requestResultMapped = Mapper.Map <SubmitOnlineDepositRequestResult>(requestResult);

            return(new OnlineDepositResponse
            {
                DepositRequestResult = requestResultMapped
            });
        }
Exemplo n.º 4
0
        public OnlineDeposit CreateOnlineDeposit(Guid playerId, decimal depositAmount, string bonusCode = "")
        {
            var player = _playerRepository.Players.Single(p => p.Id == playerId);

            var response = Task.Run(() => _onlineDepositCommands.SubmitOnlineDepositRequest(new OnlineDepositRequest
            {
                PlayerId    = playerId,
                BonusCode   = bonusCode,
                Amount      = depositAmount,
                RequestedBy = "TestHelper",
                CultureCode = "en-US",
                NotifyUrl   = "http://notifyUrl",
                ReturnUrl   = "http://returnUrl"
            })).Result;
            var deposit = _paymentRepository.OnlineDeposits.SingleOrDefault(x => x.Id == response.DepositId);

            return(deposit);
        }