/// <summary> /// Cancels a transfer token. /// </summary> /// <param name="payer">payer Token member</param> /// <param name="tokenId">token ID to cancel</param> /// <returns>operation result</returns> public static TokenOperationResult CancelTransferToken(UserMember payer, string tokenId) { // Retrieve a transfer token to cancel. Token transferToken = payer.GetTokenBlocking(tokenId); // Cancel transfer token. return(payer.CancelTokenBlocking(transferToken)); }
/// <summary> /// Cancels an access token. /// </summary> /// <param name="grantor">grantor Token member</param> /// <param name="tokenId">token ID to cancel</param> /// <returns>operation result</returns> public static TokenOperationResult CancelAccessToken(UserMember grantor, string tokenId) { // Retrieve an access token to cancel. Token accessToken = grantor.GetTokenBlocking(tokenId); // Cancel access token. return(grantor.CancelTokenBlocking(accessToken)); }
public void GetTokenTest() { using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient()) { UserMember payer = TestUtil.CreateMemberAndLinkAccounts(tokenClient); Alias granteeAlias = TestUtil.RandomAlias(); UserMember payee = tokenClient.CreateMemberBlocking(granteeAlias); Token token = CreateTransferTokenSample.CreateTransferToken(payer, granteeAlias, Level.Low); Assert.Equal(GetTokensSample.GetToken(payer, token.Id).Id, token.Id); var sigList = GetTokensSample.GetToken(payer, token.Id).PayloadSignatures.Where(sig => sig.Action == TokenSignature.Types.Action.Cancelled).ToList(); Assert.Empty(sigList); // cancel token payer.CancelTokenBlocking(token); sigList = GetTokensSample.GetToken(payer, token.Id).PayloadSignatures.Where(sig => sig.Action == TokenSignature.Types.Action.Cancelled).ToList(); Assert.NotEmpty(sigList); } }