Пример #1
0
        /// <summary>
        ///     Get transaction of account Retrieve the details of a single transaction by its ID associated to a specific account.
        /// </summary>
        /// <exception cref="ApiException">Thrown when fails to make API call</exception>
        /// <param name="accessToken"></param>
        /// <param name="accountId"></param>
        /// <param name="transactionId"></param>
        /// <returns>Transaction</returns>
        public async Task <Transaction> GetDetailAsync(AccessTokenDto accessToken, string accountId, string transactionId)
        {
            if (accessToken == null)
            {
                throw new ArgumentNullException(nameof(accessToken));
            }

            if (!accessToken.IsValid)
            {
                throw new ArgumentException($"{nameof(accessToken)} is expired.");
            }

            if (accountId == null)
            {
                throw new ArgumentNullException(nameof(accountId));
            }

            if (transactionId == null)
            {
                throw new ArgumentNullException(nameof(transactionId));
            }

            this.Configuration.AccessToken = accessToken.AccessToken;
            var transactionsApi = new TransactionsApi(this.Configuration, this.Logger);

            return(await transactionsApi
                   .GetTransctionOfAccountAsync(accountId, transactionId)
                   .ConfigureAwait(false));
        }