Example #1
0
        public void MemberGetBalancesSampleTest()
        {
            using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
            {
                UserMember member = tokenClient.CreateMemberBlocking(TestUtil.RandomAlias());
                member.CreateTestBankAccountBlocking(1000.0, "EUR");

                member.CreateTestBankAccountBlocking(500.0, "EUR");
                var balances = (List <Balance>)GetBalanceSample.MemberGetBalanceListSample(member);

                Assert.Equal(2, balances.Count);
                Assert.True(balances.Exists(b => double.Parse(b.Current.Value).Equals(500.0)));
                Assert.True(balances.Exists(b => double.Parse(b.Current.Value).Equals(1000.0)));
            }
        }
Example #2
0
        public void AccountGetBalanceSampleTest()
        {
            using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
            {
                UserMember member = tokenClient.CreateMemberBlocking(TestUtil.RandomAlias());
                member.CreateTestBankAccountBlocking(1000.0, "EUR");

                var sums = GetBalanceSample.AccountGetBalanceSample(member);
                Assert.Equal(1000.0, sums["EUR"]);
            }
        }
Example #3
0
 public void getAccessTokensTest()
 {
     using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
     {
         UserMember grantor      = tokenClient.CreateMemberBlocking(TestUtil.RandomAlias());
         string     accountId    = grantor.CreateTestBankAccountBlocking(1000, "EUR").Id();
         Alias      granteeAlias = TestUtil.RandomAlias();
         UserMember grantee      = tokenClient.CreateMemberBlocking(granteeAlias);
         Token      createdToken = CreateAndEndorseAccessTokenSample.CreateAccessToken(grantor, accountId, granteeAlias);
         Token      foundToken   = ReplaceAccessTokenSample.FindAccessToken(tokenClient, grantor, granteeAlias);
         Assert.Equal(foundToken.Id, createdToken.Id);
     }
 }
Example #4
0
        public void CancelAccessTokenByGrantorTest()
        {
            using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
            {
                Tokenio.User.Member grantor = tokenClient.CreateMemberBlocking(TestUtil.RandomAlias());
                string accountId            = grantor.CreateTestBankAccountBlocking(1000.0, "EUR").Id();
                Alias  granteeAlias         = TestUtil.RandomAlias();
                Tokenio.User.Member grantee = tokenClient.CreateMemberBlocking(granteeAlias);

                Token token = CreateAndEndorseAccessTokenSample.CreateAccessToken(grantor, accountId, granteeAlias);
                TokenOperationResult result = CancelAccessTokenSample.CancelAccessToken(grantor, token.Id);
                Assert.Equal(TokenOperationResult.Types.Status.Success, result.Status);
            }
        }
Example #5
0
 public void ReplaceAccessTokenTest()
 {
     using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
     {
         UserMember grantor      = tokenClient.CreateMemberBlocking(TestUtil.RandomAlias());
         string     accountId    = grantor.CreateTestBankAccountBlocking(1000, "EUR").Id();
         Alias      granteeAlias = TestUtil.RandomAlias();
         UserMember grantee      = tokenClient.CreateMemberBlocking(granteeAlias);
         CreateAndEndorseAccessTokenSample.CreateBalanceAccessToken(grantor, accountId, granteeAlias);
         Token activeToken = ReplaceAccessTokenSample.FindAccessToken(tokenClient, grantor, granteeAlias);
         ReplaceAccessTokenSample.ReplaceAccessToken(grantor, granteeAlias, activeToken);
         Assert.NotEqual(ReplaceAccessTokenSample.FindAccessToken(tokenClient, grantor, granteeAlias).Id,
                         activeToken.Id);
     }
 }
Example #6
0
 public void CreateAccessTokenTest()
 {
     using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
     {
         UserMember grantor      = tokenClient.CreateMemberBlocking(TestUtil.RandomAlias());
         string     accountId    = grantor.CreateTestBankAccountBlocking(1000, "EUR").Id();
         Alias      granteeAlias = TestUtil.RandomAlias();
         UserMember grantee      = tokenClient.CreateMemberBlocking(granteeAlias);
         Token      token        = CreateAndEndorseAccessTokenSample.CreateBalanceAccessToken(
             grantor,
             accountId,
             granteeAlias);
         Assert.NotNull(token);
     }
 }
Example #7
0
 public void RedeemStandingOrderTokenTest()
 {
     using (var 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        =
             CreateStandingOrderTokenSample.CreateStandingOrderToken(payer, payeeAlias, Level.Standard);
         StandingOrderSubmission submission = RedeemStandingOrderTokenSample
                                              .RedeemStandingOrderToken(payee, token.Id);
         Assert.NotNull(submission);
     }
 }
Example #8
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);
            }
        }
Example #9
0
 /// <summary>
 /// Links a Token member and a bank.
 ///
 /// <p>Bank linking is currently only supported by the Token PSD2 mobile app.
 /// This sample shows how to link a test member with a test bank account.
 /// Real bank linking works similarly, but the BankAuthorization comes from
 /// user interaction with a bank's website.</p>
 /// </summary>
 /// <param name="member">Token member to link to a bank</param>
 /// <returns>linked token accounts</returns>
 public static Tokenio.User.Account LinkBankAccounts(Tokenio.User.Member member)
 {
     return(member.CreateTestBankAccountBlocking(1000.0, "EUR"));
 }