public IHttpActionResult ChangePlayersPaymentLevel(ChangePlayersPaymentLevelData command)
        {
            VerifyPermission(Permissions.Update, Modules.PaymentLevelSettings);

            var playerIds   = command.PlayerIds;
            var allRequests = new List <ChangePaymentLevelData>();

            //verify all players
            for (int i = 0; i < playerIds.Length; i++)
            {
                var request = new ChangePaymentLevelData
                {
                    PlayerId       = playerIds[i],
                    PaymentLevelId = command.PaymentLevelId,
                    Remarks        = command.Remarks
                };


                var validationResult = _commands.ValidatePlayerPaymentLevelCanBeChanged(request);
                if (validationResult.IsValid == false)
                {
                    return(Ok(ValidationExceptionResponse(validationResult.Errors)));
                }
                allRequests.Add(request);
            }

            foreach (var request in allRequests)
            {
                _commands.ChangePaymentLevel(request);
            }
            return(Ok(new { Result = "success" }));
        }
Пример #2
0
        public void ThenPlayersPaymentLevelIsSuccessfullyChanged()
        {
            ScenarioContext.Current.Should().ContainKey("playerId");
            ScenarioContext.Current.Should().ContainKey("paymentLevelId");
            var playerId       = ScenarioContext.Current.Get <Guid>("playerId");
            var playerId2      = ScenarioContext.Current.Get <Guid>("playerId2");
            var playerId3      = ScenarioContext.Current.Get <Guid>("playerId3");
            var paymentLevelId = ScenarioContext.Current.Get <Guid>("paymentLevelId");

            Guid[] playerIds = new Guid[3] {
                playerId, playerId2, playerId3
            };
            var data = new ChangePlayersPaymentLevelData
            {
                PaymentLevelId = paymentLevelId,
                PlayerIds      = playerIds,
                Remarks        = TestDataGenerator.GetRandomString()
            };

            var result = AdminApiProxy.ChangePlayersPaymentLevelInPlayerManager(data);

            result.Should().NotBeNull();
            result.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.OK);
        }
Пример #3
0
 public HttpResponseMessage ChangePlayersPaymentLevelInPlayerManager(ChangePlayersPaymentLevelData request)
 {
     return(WebClient.SecurePostAsJson <ChangePlayersPaymentLevelData, HttpResponseMessage>(Token, _url + AdminApiRoutes.ChangePlayersPaymentLevelInPlayerManager, request));
 }