Beispiel #1
0
        public void RedeemTransactionsAccessTokenTest()
        {
            using (var tokenClient = TestUtil.CreateClient())
            {
                UserMember grantor      = TestUtil.CreateUserMember();
                string     accountId    = grantor.GetAccountsBlocking()[0].Id();
                Alias      granteeAlias = TestUtil.RandomAlias();
                TppMember  grantee      = tokenClient.CreateMemberBlocking(granteeAlias);

                // make some transactions
                Alias     payeeAlias   = TestUtil.RandomAlias();
                TppMember payee        = tokenClient.CreateMemberBlocking(payeeAlias);
                var       payeeAccount = payee.CreateTestBankAccountBlocking(1000, "EUR");
                for (int i = 0; i < 5; i++)
                {
                    Token token = CreateTransferTokenSample.CreateTransferToken(
                        grantor,
                        payeeAlias,
                        Key.Types.Level.Standard);
                    RedeemTransferTokenSample.RedeemTransferToken(
                        payee,
                        payeeAccount.Id(),
                        token.Id);
                }

                Token accessToken =
                    CreateAndEndorseAccessTokenSample.CreateTransactionsAccessToken(grantor, accountId, granteeAlias);
                IList <Transaction> transactions =
                    RedeemAccessTokenSample.RedeemTransactionsAccessToken(grantee, accessToken.Id);

                Assert.Equal(5, transactions.Count);
            }
        }
Beispiel #2
0
        public void CancelTransferTokenByGranteeTest()
        {
            using (Tokenio.Tpp.TokenClient tokenClient = TestUtil.CreateClient())
            {
                UserMember grantor      = TestUtil.CreateUserMember();
                Alias      granteeAlias = TestUtil.RandomAlias();
                TppMember  grantee      = tokenClient.CreateMemberBlocking(granteeAlias);

                Token token = CreateTransferTokenSample.CreateTransferToken(grantor, granteeAlias, Level.Low);
                TokenOperationResult result = CancelTokenSample.CancelTransferToken(grantee, token.Id);
                Assert.Equal(result.Status, TokenOperationResult.Types.Status.Success);
            }
        }
Beispiel #3
0
        public void RedeemPaymentTokenTest()
        {
            using (Tokenio.Tpp.TokenClient tokenClient = TestUtil.CreateClient())
            {
                UserMember payer      = TestUtil.CreateUserMember();
                Alias      payeeAlias = TestUtil.RandomAlias();
                TppMember  payee      = tokenClient.CreateMemberBlocking(payeeAlias);

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

                Token token = CreateTransferTokenSample.CreateTransferToken(payer, payeeAlias, Level.Low);

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