예제 #1
0
        /// <summary>
        /// Call the Accounts API, on behalf of a User, to credit an account with some amount.
        /// </summary>
        /// <param name="accountNumber">The account to be modified.</param>
        /// <param name="amount">The (unsigned) amount to be credited to the account.</param>
        /// <param name="memo">A short note to be attached to this transaction.</param>
        /// <param name="userCredentialsCallback">A delegate that, if invoked, returns the User's credentials.</param>
        /// <returns>The new balance for the modified account.</returns>
        ///
        public async Task <double> CreditAccount(string accountNumber, double amount, string memo,
                                                 UserCredentialsCallback userCredentialsCallback)
        {
            double balance;

            var accessToken = await GetCurrentAccessToken(userCredentialsCallback);

            using (var accountsApi = new AccountsApiClient(_accountsApiUrl, accessToken))
            {
                balance = await accountsApi.CreditAccount(accountNumber, amount, memo);
            }

            return(balance);
        }