public async Task <IActionResult> ModifyWallet(string id, [FromBody] ModifyWalletRequest request)
        {
            // checking if wallet exists and user owns the specified wallet
            var wallet = await GetClientWallet(id);

            if (wallet == null)
            {
                return(NotFound());
            }

            wallet = await _clientAccountService.Wallets.ModifyWalletAsync(id,
                                                                           new Lykke.Service.ClientAccount.Client.Models.Request.Wallets.ModifyWalletRequest
            {
                Name = request.Name, Description = request.Description
            });

            if (wallet == null)
            {
                return(NotFound());
            }

            return(Ok(new WalletModel {
                Id = wallet.Id, Name = wallet.Name, Type = wallet.Type.ToString(), Description = wallet.Description
            }));
        }
        public void PutWallet()
        {
            var walletToCreate = new CreateWalletRequest().GetTestModel(userId);
            var createdWalet   = lykkeApi.ClientAccount.Wallets.PostCreateWallet(walletToCreate).GetResponseObject();

            var newWallet = new ModifyWalletRequest().GetTestModel();

            var putWalletById = lykkeApi.ClientAccount.Wallets.PutWalletById(createdWalet.Id, newWallet);

            Assert.That(putWalletById.StatusCode, Is.EqualTo(HttpStatusCode.OK));

            var changedWallet = lykkeApi.ClientAccount.Wallets.GetWalletById(createdWalet.Id).GetResponseObject();

            //Have not to change
            Assert.That(changedWallet.Id, Is.EqualTo(createdWalet.Id));
            Assert.That(changedWallet.Type, Is.EqualTo(createdWalet.Type));
            //Have to be changed
            Assert.That(changedWallet.Name, Is.EqualTo(newWallet.Name));
            Assert.That(changedWallet.Description, Is.EqualTo(newWallet.Description));
        }
 public IResponse <WalletModel> PutWalletsId(ModifyWalletRequest request, string walletId, string authorization) =>
 Request.Put($"/wallets/{walletId}").AddJsonBody(request).WithBearerToken(authorization).Build().Execute <WalletModel>();
Example #4
0
 public IResponse <WalletDto> PutWalletById(string id, ModifyWalletRequest modifyWallet)
 {
     return(Request.Put($"/api/Wallets/{id}").AddJsonBody(modifyWallet).Build().Execute <WalletDto>());
 }
Example #5
0
 public static ModifyWalletRequest GetTestModel(this ModifyWalletRequest modify) =>
 new ModifyWalletRequest()
 {
     Name        = "Brand new test name",
     Description = "Brand new test description"
 };