示例#1
0
        /// <summary>
        ///     List transactions Get a list of the transactions of all accounts. You can additionally constrain the amount of
        ///     transactions being returned by using the query parameters described below as filters.
        /// </summary>
        /// <exception cref="ApiException">Thrown when fails to make API call</exception>
        /// <param name="accessToken"></param>
        /// <param name="listFilter">
        ///     (optional)
        ///     count:
        ///     Limit the number of returned items. In combination with the offset parameter this can be used to
        ///     paginate the result list. (optional, default to 1000)
        ///     offset:
        ///     Skip this number of transactions in the response. In combination with the count parameter this can
        ///     be used to paginate the result list. (optional, default to 0)
        ///     since:
        ///     Return only transactions after this date based on since_type. This parameter can either
        ///     be a transaction ID or a date. Given at least one transaction matches the filter criterion, if provided as
        ///     transaction ID the result will *not* contain this ID. If provided as ISO date, the result *will* contain this date.
        ///     This behavior may change in the future. (optional)
        ///     sinceType:
        ///     This parameter defines how the parameter since will be interpreted. (optional,
        ///     default to created)
        ///     filter:
        ///     Filter transactions by given key:value combination. Possible keys:    - date (maps to
        ///     booked_at, please use ISO date here, not datetime)   - person (maps to payer/payee name)   - purpose
        ///     - amount  Values are interpreted using wildcards: person:John Doe will match %John Doe%.
        ///     (optional)
        ///     includePending:
        ///     This flag indicates whether pending transactions should be included in the response.
        ///     Pending transactions are always included as a complete set, regardless of the since parameter. (optional, default
        ///     to false)
        ///     sort
        ///     Determines whether results will be sorted in ascending or descending order. (optional)
        ///     until:
        ///     Return only transactions which were booked on or before this date. Please provide as ISO date. It
        ///     is not possible to use the since_type semantics with until. (optional)
        ///     includeStatistics:
        ///     If true includes statistics on the returned transactions: maximum deposit,
        ///     total deposits, maximum expense, total expenses.  (optional, default to false)
        ///     filter:
        ///     Filter transactions by given key:value combination. Possible keys:    - date (maps to
        ///     booked_at, please use ISO date here, not datetime)   - person (maps to payer/payee name)   - purpose
        ///     - amount  Values are interpreted using wildcards: person:John Doe will match %John Doe%.
        ///     (optional)
        /// </param>
        /// <returns>TransactionList</returns>
        public async Task <TransactionList> GetAllAsync(AccessTokenDto accessToken, AccountListFilter listFilter = default)
        {
            if (accessToken == null)
            {
                throw new ArgumentNullException(nameof(accessToken));
            }

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

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

            return(await transactionsApi.ListTransactionsAsync(
                       null,
                       listFilter?.Filter,
                       null,
                       listFilter?.Count,
                       listFilter?.Offset,
                       listFilter?.Sort,
                       listFilter?.Since?.ToString("O"),
                       listFilter?.Until?.ToString("O"),
                       listFilter?.SinceType,
                       listFilter?.Types,
                       listFilter?.Cents,
                       listFilter?.IncludePending,
                       listFilter?.IncludeStatistics).ConfigureAwait(false));
        }
 public async Task<StripeResponse<Pagination<Account>>> GetAccounts(AccountListFilter filter,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new StripeRequest<AccountListFilter, Pagination<Account>>
     {
         UrlPath = Paths.Accounts,
         Model = filter
     };
     return await _client.Get(request, cancellationToken);
 }
示例#3
0
        public async Task <StripeResponse <Pagination <Account> > > GetAccounts(AccountListFilter filter,
                                                                                CancellationToken cancellationToken = default(CancellationToken))
        {
            var request = new StripeRequest <AccountListFilter, Pagination <Account> >
            {
                UrlPath = Paths.Accounts,
                Model   = filter
            };

            return(await _client.Get(request, cancellationToken));
        }
        public void AccountListFilter_DoesNotHaveRequiredFields()
        {
            // Arrange 
            _filter = new AccountListFilter();

            // Act
            Func<IEnumerable<KeyValuePair<string, string>>> func = () => StripeClient.GetModelKeyValuePairs(_filter);

            // Assert
            func.Enumerating().ShouldNotThrow();
        }
示例#5
0
        public void AccountListFilter_DoesNotHaveRequiredFields()
        {
            // Arrange
            _filter = new AccountListFilter();

            // Act
            Func <IEnumerable <KeyValuePair <string, string> > > func = () => StripeClient.GetModelKeyValuePairs(_filter);

            // Assert
            func.Enumerating().ShouldNotThrow();
        }
        public async Task GetAccountsTest()
        {
            // Arrange
            var filter = new AccountListFilter();
            _stripe.Get(
                Arg.Is<StripeRequest<AccountListFilter, Pagination<Account>>>(
                    a => a.UrlPath == "accounts" && a.Model == filter), _cancellationToken)
                .Returns(Task.FromResult(new StripeResponse<Pagination<Account>>()));

            // Act
            var response = await _client.GetAccounts(filter, _cancellationToken);

            // Assert
            response.Should().NotBeNull();
        }
        public async Task GetAccountsTest()
        {
            // Arrange
            var filter = new AccountListFilter();

            _stripe.Get(
                Arg.Is <StripeRequest <AccountListFilter, Pagination <Account> > >(
                    a => a.UrlPath == "accounts" && a.Model == filter), _cancellationToken)
            .Returns(Task.FromResult(new StripeResponse <Pagination <Account> >()));

            // Act
            var response = await _client.GetAccounts(filter, _cancellationToken);

            // Assert
            response.Should().NotBeNull();
        }
 public void Init()
 {
     _filter = GenFu.GenFu.New<AccountListFilter>();
 }
示例#9
0
 public void Init()
 {
     _filter = GenFu.GenFu.New <AccountListFilter>();
 }