コード例 #1
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            _driver.Logout();
            _playerTestHelper  = _container.Resolve <PlayerTestHelper>();
            _paymentTestHelper = _container.Resolve <PaymentTestHelper>();
            _player            = _playerTestHelper.CreatePlayer();
            _playerBankAccount = _paymentTestHelper.CreatePlayerBankAccount(_player.Id, _player.BrandId);

            _dashboardPage = _driver.LoginToAdminWebsiteAsSuperAdmin();
            _playerBankAccountVerifyPage = _dashboardPage.Menu.ClickPlayerBankAccountVerifyMenuItem();
        }
コード例 #2
0
        public RejectPlayerBankAccountValidator(IPaymentRepository repository)
        {
            PlayerBankAccount playerBankAccount = null;

            RuleFor(x => x.Id)
            .Must(x =>
            {
                playerBankAccount = repository.PlayerBankAccounts.SingleOrDefault(y => y.Id == x);

                return(playerBankAccount != null);
            })
            .WithMessage("{\"text\": \"app:common.idDoesNotExist\"}");

            When(x => playerBankAccount != null, () => RuleFor(x => x.Id)
                 .Must(x => playerBankAccount.Status == BankAccountStatus.Pending)
                 .WithMessage("{\"text\": \"app:payment.playerBankAccountNotPending\"}"));
        }
コード例 #3
0
        public static void OnBankCommand(Player sender)
        {
            if (!sender.IsLoggedInBankAccount)
            {
                if (sender.BankAccount == null)
                {
                    var registerNewBankAccountDialog = new InputDialog("Enter a password",
                                                                       "Please enter a password to register your bank account:", true, "Accept", "Cancel");
                    registerNewBankAccountDialog.Show(sender);
                    registerNewBankAccountDialog.Response += async(senderObject, e) =>
                    {
                        if (e.DialogButton != DialogButton.Left)
                        {
                            return;
                        }

                        if (e.InputText.Length < 1 || e.InputText.Length > 20)
                        {
                            sender.SendClientMessage(Color.Red, Messages.InvalidPasswordLength, 1, 20);
                            registerNewBankAccountDialog.Show(sender);
                            return;
                        }

                        var hash           = PasswordHashingService.GetPasswordHash(e.InputText);
                        var newBankAccount = new PlayerBankAccount {
                            Password = hash, PlayerId = sender.Account.Id
                        };
                        await new PlayerBankAccountRepository(ConnectionFactory.GetConnection).AddAsync(newBankAccount);

                        sender.SendClientMessage(Color.GreenYellow, Messages.BankAccountCreatedSuccessfully);
                    };
                }
                else
                {
                    var loginBankAccount = new InputDialog("Enter a password",
                                                           "Enter a password to login to your bank account:", true, "Accept", "Cancel");
                    loginBankAccount.Show(sender);
                    loginBankAccount.Response += (senderObject, e) =>
                    {
                        if (e.InputText.Length < 1 || e.InputText.Length > 20)
                        {
                            sender.SendClientMessage(Color.Red, Messages.InvalidPasswordLength, 1, 20);
                            loginBankAccount.Show(sender);
                            return;
                        }

                        if (!PasswordHashingService.VerifyPasswordHash(e.InputText, sender.BankAccount.Password))
                        {
                            sender.SendClientMessage(Color.Red, Messages.InvalidPasswordInputted);
                            loginBankAccount.Show(sender);
                            return;
                        }

                        sender.IsLoggedInBankAccount = true;
                        sender.SendClientMessage(Color.GreenYellow, Messages.BankAccountLoggedInSuccessfully);
                        sender.ShowBankAccountOptions();
                    };
                }
            }
            else
            {
                sender.ShowBankAccountOptions();
            }
        }
コード例 #4
0
        private IHttpActionResult SerializePlayerAndBankAccount(Core.Payment.Interface.Data.Player player, PlayerBankAccount bankAccount)
        {
            object bankAccountSent = null;

            if (bankAccount != null)
            {
                var bankAcccountTime = bankAccount.Updated ?? bankAccount.Created;
                var bankTime         = bankAccount.Bank.Updated ?? bankAccount.Bank.Created;

                bankAccountSent = new
                {
                    bankAccount.Id,
                    Bank = bankAccount.Bank.Id,
                    bankAccount.Bank.BankName,
                    bankAccount.Province,
                    bankAccount.City,
                    bankAccount.Branch,
                    bankAccount.SwiftCode,
                    bankAccount.Address,
                    bankAccount.AccountName,
                    bankAccount.AccountNumber,
                    bankAccount.Status,
                    bankAccount.EditLock,
                    Time     = bankAcccountTime.ToString("o"),
                    BankTime = bankTime.ToString("o")
                };
            }
            return(Ok(new
            {
                Result = "success",
                Player = SelectPlayerDataForBankAccount(player),
                BankAccount = bankAccountSent
            }));
        }