public void CreatePaymentTokenTest()
 {
     using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
     {
         UserMember payer      = TestUtil.CreateMemberAndLinkAccounts(tokenClient);
         Alias      payeeAlias = TestUtil.RandomAlias();
         UserMember payee      = tokenClient.CreateMemberBlocking(payeeAlias);
         Token      token      = CreateAndEndorseTransferTokenSample.CreateTransferToken(payer, payeeAlias);
         Assert.NotNull(token);
     }
 }
        public void CancelTransferTokenByGrantorTest()
        {
            using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
            {
                UserMember payer        = TestUtil.CreateMemberAndLinkAccounts(tokenClient);
                Alias      granteeAlias = TestUtil.RandomAlias();
                UserMember payee        = tokenClient.CreateMemberBlocking(granteeAlias);

                Token token = CreateAndEndorseTransferTokenSample.CreateTransferToken(payer, granteeAlias);
                TokenOperationResult result = CancelTransferTokenSample.CancelTransferToken(payer, token.Id);
                Assert.Equal(TokenOperationResult.Types.Status.Success, result.Status);
            }
        }
示例#3
0
        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 = CreateAndEndorseTransferTokenSample.CreateTransferToken(payer, granteeAlias);

                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);
            }
        }
        public void RedeemPaymentTokenTest()
        {
            using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
            {
                UserMember payer      = TestUtil.CreateMemberAndLinkAccounts(tokenClient);
                Alias      payeeAlias = TestUtil.RandomAlias();
                UserMember payee      = tokenClient.CreateMemberBlocking(payeeAlias);

                Account payeeAccount = LinkMemberAndBankSample.LinkBankAccounts(payee);

                Token token = CreateAndEndorseTransferTokenSample.CreateTransferToken(payer, payeeAlias);

                Transfer transfer = RedeemTransferTokenSample.RedeemTransferToken(
                    payee,
                    payeeAccount.Id(),
                    token.Id);
                Assert.NotNull(transfer);
            }
        }
示例#5
0
        public void GetTransferTokensTest()
        {
            using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
            {
                UserMember payer      = TestUtil.CreateMemberAndLinkAccounts(tokenClient);
                Alias      payeeAlias = TestUtil.RandomAlias();
                UserMember payee      = tokenClient.CreateMemberBlocking(payeeAlias);

                Account payeeAccount = payee.CreateTestBankAccountBlocking(1000, "EUR");

                Token token = CreateAndEndorseTransferTokenSample.CreateTransferToken(payer, payeeAlias);

                Transfer transfer = RedeemTransferTokenSample.RedeemTransferToken(
                    payee,
                    payeeAccount.Id(),
                    token.Id);

                GetTransfersSample.GetTransferTokensSample(payee);
            }
        }
        public void AccountGetTransactionsTest()
        {
            using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
            {
                UserMember payer      = TestUtil.CreateMemberAndLinkAccounts(tokenClient);
                Alias      payeeAlias = TestUtil.RandomAlias();
                UserMember payee      = tokenClient.CreateMemberBlocking(payeeAlias);

                Account payeeAccount = LinkMemberAndBankSample.LinkBankAccounts(payee);

                Token token = CreateAndEndorseTransferTokenSample.CreateTransferToken(payer, payeeAlias);

                Transfer transfer = RedeemTransferTokenSample.RedeemTransferToken(
                    payee,
                    payeeAccount.Id(),
                    token.Id);

                GetTransactionsSample.AccountGetTransactionSample(payer, transfer);
                Transaction transaction = GetTransactionsSample.AccountGetTransactionSample(payer, transfer);

                Assert.Equal(transaction.TokenId, token.Id);
            }
        }