/// <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(
            Member payer,
            Transfer transfer)
        {
            var account = payer.GetAccounts().Result[0];

            var txnId       = transfer.TransactionId;
            var transaction = account.GetTransaction(txnId, Standard).Result;

            return(transaction);
        }
示例#2
0
        /// <summary>
        /// Get a member's list of balances.
        /// </summary>
        /// <param name="member">member</param>
        /// <returns>a list of balances</returns>
        public static IList <Balance> MemberGetBalanceListSample(Member member)
        {
            var accountIds = member.GetAccounts()
                             .Result
                             .Select(account => account.Id())
                             .ToList();

            var balances = member.GetBalances(accountIds, Standard).Result;

            return(balances);
        }
        /// <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(
            Member payer,
            Transfer transfer)
        {
            var accounts  = payer.GetAccounts().Result;
            var accountId = accounts[0].Id();

            var transactionId = transfer.TransactionId;
            var transaction   = payer.GetTransaction(accountId, transactionId, Standard).Result;

            return(transaction);
        }
        /// <summary>
        /// Illustrate Account.GetTransactions
        /// </summary>
        /// <param name="payer">payer Token member</param>
        public static void AccountGetTransactionsSample(Member payer)
        {
            var account = payer.GetAccounts().Result[0];

            foreach (var transaction in account.GetTransactions(null, 10, Standard).Result.List)
            {
                DisplayTransaction(
                    transaction.Amount.Currency,
                    transaction.Amount.Value,
                    transaction.Type, // debit or credit
                    transaction.Status);
            }
        }
        /// <summary>
        /// Illustrate Member.GetTransactions
        /// </summary>
        /// <param name="payer">payer Token member</param>
        public static void GetTransactionsSample_(Member payer)
        {
            var accounts  = payer.GetAccounts().Result;
            var accountId = accounts[0].Id();

            foreach (var transaction in payer.GetTransactions(accountId, 10, Standard, null).Result.List)
            {
                DisplayTransaction(
                    transaction.Amount.Currency,
                    transaction.Amount.Value,
                    transaction.Type, // debit or credit
                    transaction.Status);
            }
        }
示例#6
0
        /// <summary>
        /// Get a member's balances.
        /// </summary>
        /// <param name="member">member</param>
        /// <returns>dictionary currency: total</returns>
        public static IDictionary <string, double> MemberGetBalanceSample(Member member)
        {
            var sums = new Dictionary <string, double>();

            var accounts = member.GetAccounts().Result;

            foreach (var account in accounts)
            {
                var balance = member.GetBalanceBlocking(account.Id(), Standard).Current;
                if (sums.ContainsKey(balance.Currency))
                {
                    sums[balance.Currency] += Convert.ToDouble(balance.Value);
                }
                else
                {
                    sums[balance.Currency] = Convert.ToDouble(balance.Value);
                }
            }

            return(sums);
        }