Beispiel #1
0
        public static async Task <TransactionsResponse> GetAllTransactions(this ITransactionApi myPontoApi, Guid accountId)
        {
            var allTransactionsResponse = new TransactionsResponse();

            allTransactionsResponse.Data = new List <TransactionResource>();

            var transactionResponse = await myPontoApi.GetTransactions(accountId);

            allTransactionsResponse.Meta        = transactionResponse.Meta;
            allTransactionsResponse.Meta.Paging = null;
            TransactionsResponse nextPage = await transactionResponse.Links.GetFirstPage();

            allTransactionsResponse.Data.AddRange(nextPage.Data);
            if (nextPage.Links.Next != null)
            {
                do
                {
                    nextPage = await nextPage.Links.GetNextPage();

                    allTransactionsResponse.Data.AddRange(nextPage.Data);
                    allTransactionsResponse.Links = nextPage.Links;
                } while (nextPage.Links.Next != null);
            }

            return(allTransactionsResponse);
        }
Beispiel #2
0
        public void AddTransactionApi(string key, ITransactionApi api)
        {
            Check.NotNull(key, nameof(key));
            Check.NotNull(api, nameof(api));

            if (_transactionApis.ContainsKey(key))
            {
                throw new AbpException("There is already a transaction API in this unit of work with given key: " + key);
            }

            _transactionApis.Add(key, api);
        }
Beispiel #3
0
        public static async Task <TransactionsResponse> GetNewTransactions(this ITransactionApi myPontoApi, Guid accountId, Guid lastKnownTransactionId)
        {
            var allTransactionsResponse = new TransactionsResponse();

            allTransactionsResponse.Data = new List <TransactionResource>();
            var transactionResponse = await myPontoApi.GetTransactionsBefore(accountId, lastKnownTransactionId);

            allTransactionsResponse.Meta        = transactionResponse.Meta;
            allTransactionsResponse.Meta.Paging = null;
            allTransactionsResponse.Data.AddRange(transactionResponse.Data);
            if (transactionResponse.Links.Prev != null)
            {
                do
                {
                    transactionResponse = await transactionResponse.Links.GetPreviousPage();

                    allTransactionsResponse.Data.AddRange(transactionResponse.Data);
                    allTransactionsResponse.Links = transactionResponse.Links;
                } while (transactionResponse.Links.Prev != null);
            }

            return(allTransactionsResponse);
        }
Beispiel #4
0
 public void AddTransactionApi(string key, ITransactionApi api)
 {
     _parent.AddTransactionApi(key, api);
 }
 public TransactionRepository(ITransactionApi transactionApi)
 {
     this.transactionApi = transactionApi;
 }
Beispiel #6
0
 /// <inheritdoc/>
 public void AddTransactionApi(ITransactionApi api)
 {
     _transactionApi = api;
 }
Beispiel #7
0
 public void AddTransactionApi(ITransactionApi api)
 {
     _parent.AddTransactionApi(api);
 }