public void GetTransactionsTest() { 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 = TestUtil.CreateTransferToken(payer, payeeAlias); Transfer transfer = RedeemTransferTokenSample.RedeemTransferToken( payee, payeeAccount.Id(), token.Id); string transactionId = transfer.TransactionId; Transaction transaction = payer.GetTransactionBlocking( payer.GetAccountsBlocking()[0].Id(), transactionId, Key.Types.Level.Standard); Assert.Equal(transaction.TokenId, token.Id); } }
public void RedeemStandingOrdersAccessTokenTest() { 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 standing orders Alias payeeAlias = TestUtil.RandomAlias(); TppMember payee = tokenClient.CreateMemberBlocking(payeeAlias); for (int i = 0; i < 5; i++) { Token token = CreateStandingOrderTokenSample.CreateStandingOrderToken( grantor, payeeAlias, Key.Types.Level.Standard); RedeemStandingOrderTokenSample.RedeemStandingOrderToken( payee, token.Id); } Token accessToken = CreateAndEndorseAccessTokenSample.CreateStandingOrdersAccessToken(grantor, accountId, granteeAlias); IList <StandingOrder> standingOrders = RedeemAccessTokenSample.RedeemStandingOrdersAccessToken(grantee, accessToken.Id); Assert.Equal(5, standingOrders.Count); } }
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); } }
/// <summary> /// Get a member's list of balances. /// </summary> /// <param name="member">Member.</param> /// <returns>list of balances</returns> public static IList <Balance> MemberGetBalanceListSample(UserMember member) { List <string> accountIds = member .GetAccountsBlocking().Select(acc => acc.Id()).ToList(); var balances = member.GetBalancesBlocking(accountIds, Key.Types.Level.Standard); return(balances); }
public void LinkMemberAndBankTest() { using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient()) { UserMember member = tokenClient.CreateMemberBlocking(TestUtil.RandomAlias()); LinkMemberAndBankSample.LinkBankAccounts(member); Assert.NotEmpty(member.GetAccountsBlocking()); } }
/// <summary> /// Illustrate Account.getTransaction /// </summary> /// <param name="payer">payer Token member</param> /// <param name="transfer">recently-completed transfer</param> /// <returns>a Transaction</returns> public static Transaction AccountGetTransactionSample( UserMember payer, Transfer transfer) { Tokenio.User.Account account = payer.GetAccountsBlocking()[0]; string txnId = transfer.TransactionId; Transaction transaction = account.GetTransactionBlocking(txnId, Level.Standard); return(transaction); }
/// <summary> /// Illustrate Account.getTransactions /// </summary> /// <param name="payer">payer Token member</param> public static void AccountGetTransactionsSample(UserMember payer) { Tokenio.User.Account account = payer.GetAccountsBlocking()[0]; foreach (Transaction transaction in account.GetTransactionsBlocking(null, 10, Level.Standard).List) { DisplayTransaction( transaction.Amount.Currency, transaction.Amount.Value, transaction.Type, // debit or credit transaction.Status); } }
/// <summary> /// Illustrate Member.getTransaction /// </summary> /// <param name="payer">payer Token member</param> /// <param name="transfer">recently-completed transfer</param> /// <returns>a Transaction</returns> public static Transaction GetTransactionSample( UserMember payer, Transfer transfer) { List <Tokenio.User.Account> accounts = payer.GetAccountsBlocking().ToList(); string accountId = accounts[0].Id(); string transactionId = transfer.TransactionId; Transaction transaction = payer.GetTransactionBlocking(accountId, transactionId, Level.Standard); return(transaction); }
public void CancelAccessTokenByGranteeTest() { using (Tokenio.Tpp.TokenClient tokenClient = TestUtil.CreateClient()) { Tokenio.User.Member grantor = TestUtil.CreateUserMember(); string accountId = grantor.GetAccountsBlocking()[0].Id(); Alias granteeAlias = TestUtil.RandomAlias(); TppMember grantee = tokenClient.CreateMemberBlocking(granteeAlias); Token token = TestUtil.CreateAccessToken(grantor, accountId, granteeAlias); TokenOperationResult result = CancelAccessTokenSample.CancelAccessToken(grantee, token.Id); Assert.Equal(result.Status, TokenOperationResult.Types.Status.Success); } }
/// <summary> /// Get a member's balances. /// </summary> /// <param name="member">Member.</param> /// <returns>map currency: total</returns> public static IDictionary <string, double> AccountGetBalanceSample(UserMember member) { Dictionary <string, double> sums = new Dictionary <string, double>(); IList <Tokenio.User.Account> accounts = member.GetAccountsBlocking(); foreach (Tokenio.User.Account account in accounts) { Money balance = account.GetBalanceBlocking(Key.Types.Level.Standard).Current; sums[balance.Currency] = Double.Parse(balance.Value) + SampleExtensions.GetValueOrDefault(sums, balance.Currency, 0.0); } return(sums); }
/// <summary> /// Illustrate Member.getTransactions /// </summary> /// <param name="payer">payer Token member</param> public static void getTransactionsSample(UserMember payer) { List <Tokenio.User.Account> accounts = payer.GetAccountsBlocking().ToList(); string accountId = accounts[0].Id(); foreach (Transaction transaction in payer.GetTransactionsBlocking(accountId, 10, Level.Standard, null).List) { DisplayTransaction( transaction.Amount.Currency, transaction.Amount.Value, transaction.Type, // debit or credit transaction.Status); } }
/// <summary> /// Illustrate Member.getTransfers /// </summary> /// <param name="payer">payer Token member</param> public static void GetTransfers_Sample(UserMember payer) { var accounts = payer.GetAccountsBlocking(); string accountId = accounts[0].Id(); foreach (Transfer transfer in payer.GetTransfersBlocking(null, null, 10).List) { DisplayTransfer( transfer.Status, transfer.Payload.Description); } }
public void RedeemAccessTokenTest() { using (Tokenio.Tpp.TokenClient tokenClient = TestUtil.CreateClient()) { UserMember grantor = TestUtil.CreateUserMember(); string accountId = grantor.GetAccountsBlocking()[0].Id(); Alias granteeAlias = TestUtil.RandomAlias(); TppMember grantee = tokenClient.CreateMemberBlocking(granteeAlias); Token token = TestUtil.CreateAccessToken(grantor, accountId, granteeAlias); Money balance0 = RedeemAccessTokenSample.RedeemAccessToken(grantee, token.Id); Assert.True(Convert.ToDecimal(balance0.Value) > (decimal.One * 10)); } }