public DwollaResponse <DwollaTransaction> GetById(string transactionId, string oAuthToken)
        {
            var parameters = new Dictionary <string, object> {
                { "oauth_token", oAuthToken }
            };

            var endpoint = string.Format("{0}/{1}", Urls.Transactions, transactionId);

            string encodedUrl = HttpHelper.BuildUrl(endpoint, parameters);

            string rawResponse = Requestor.GetString(encodedUrl);

            return(Mapper <DwollaResponse <DwollaTransaction> > .MapFromJson(rawResponse));
        }
        public virtual SearchResults <RecurringChargeOccurrence> Occurrences(
            string recurringChargeId,
            int page     = 1,
            int pageSize = 20)
        {
            var url = string.Format("{0}/{1}/occurrences", Urls.RecurringCharges, recurringChargeId);

            url = ParameterBuilder.ApplyParameterToUrl(url, "page", page.ToString());
            url = ParameterBuilder.ApplyParameterToUrl(url, "page_size", pageSize.ToString());

            var response = Requestor.GetString(url, SecretKey);

            return(Mapper <RecurringChargeOccurrence> .MapCollectionFromJson(response));
        }
        public virtual SearchResults <Transaction> Transactions(
            int page           = 1,
            int pageSize       = 20,
            string q           = null,
            string qf          = null,
            DateTime?startDate = null,
            DateTime?endDate   = null,
            string accountId   = null,
            string orderBy     = null)
        {
            var url = Urls.Transactions;

            url = ParameterBuilder.ApplyParameterToUrl(url, "page", page.ToString());
            url = ParameterBuilder.ApplyParameterToUrl(url, "page_size", pageSize.ToString());

            if (!string.IsNullOrEmpty(q))
            {
                url = ParameterBuilder.ApplyParameterToUrl(url, "q", q);
            }

            if (!string.IsNullOrEmpty(qf))
            {
                url = ParameterBuilder.ApplyParameterToUrl(url, "qf", qf);
            }

            if (startDate != null)
            {
                url = ParameterBuilder.ApplyParameterToUrl(url, "start_date", ((DateTime)startDate).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ"));
            }

            if (endDate != null)
            {
                url = ParameterBuilder.ApplyParameterToUrl(url, "end_date", ((DateTime)endDate).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ"));
            }

            if (!string.IsNullOrEmpty(accountId))
            {
                url = ParameterBuilder.ApplyParameterToUrl(url, "account_id", accountId);
            }

            if (!string.IsNullOrEmpty(orderBy))
            {
                url = ParameterBuilder.ApplyParameterToUrl(url, "order_by", orderBy);
            }

            var response = Requestor.GetString(url, SecretKey);

            return(TransactionMapper.MapCollectionFromJson(response));
        }
        public virtual SearchResults <Bank> ListBanks(int page = 1, int page_size = 20, string reference = null)
        {
            var url = Urls.Banks;

            url = ParameterBuilder.ApplyParameterToUrl(url, "page", page.ToString());
            url = ParameterBuilder.ApplyParameterToUrl(url, "page_size", page_size.ToString());
            if (reference != null)
            {
                url = ParameterBuilder.ApplyParameterToUrl(url, "reference", reference);
            }

            var response = Requestor.GetString(url, SecretKey);

            return(Mapper <Bank> .MapCollectionFromJson(response));
        }
示例#5
0
        public DwollaResponse <DwollaUser> GetBasicAccount(string userId, string key, string secret)
        {
            var parameters = new Dictionary <string, object>()
            {
                { "client_id", key },
                { "client_secret", secret }
            };

            var    endPoint   = string.Format("{0}/{1}", Urls.Users, userId);
            string encodedUrl = HttpHelper.BuildUrl(endPoint, parameters);

            var rawResponse = Requestor.GetString(encodedUrl);

            return(Mapper <DwollaResponse <DwollaUser> > .MapFromJson(rawResponse));
        }
        public DwollaResponse <IList <DwollaTransaction> > GetByUser(ListTransactionOptions options)
        {
            var parameters = new Dictionary <string, object>()
            {
                { "oauth_token", options.OAuthToken },
                { "sinceDate", options.SinceDate },
                { "types", options.Types },
                { "limit", options.Limit },
                { "skip", options.Limit }
            };

            string encodedUrl = HttpHelper.BuildUrl(Urls.Transactions, parameters);

            var rawResponse = Requestor.GetString(encodedUrl);

            return(Mapper <DwollaResponse <IList <DwollaTransaction> > > .MapFromJson(rawResponse));
        }
        // Todo: not sure if this still works
        public DwollaResponse <DwollaTransaction> GetById(
            string transactionId, string appKey, string appSecret)
        {
            var parameters = new Dictionary <string, object>()
            {
                { "client_id", appKey },
                { "client_secret", appSecret }
            };

            var endpoint = string.Format("{0}/{1}", Urls.Transactions, transactionId);

            string encodedUrl = HttpHelper.BuildUrl(endpoint, parameters);

            string rawResponse = Requestor.GetString(encodedUrl);

            return(Mapper <DwollaResponse <DwollaTransaction> > .MapFromJson(rawResponse));
        }
示例#8
0
        public virtual OrderBookResponse GetOrderBook(string currencyPair, int depth)
        {
            if (String.IsNullOrWhiteSpace(currencyPair))
            {
                throw new ArgumentException();
            }

            if (depth <= 0)
            {
                throw new ArgumentException();
            }

            var result = JsonConvert.DeserializeObject <OrderBookResponse>(
                Requestor.GetString(Urls.OrderBook(currencyPair, depth)));

            return(result);
        }
        public DwollaResponse <DwollaTransactionStats> GetTransactionStats(TransactionStatsOptions options)
        {
            var url = Urls.Transactions + "/stats";

            var parameters = new Dictionary <string, object>()
            {
                { "oauth_token", options.OAuthToken },
                { "types", options.StatTypes },
                { "startDate", options.StartDate },
                { "endDate", options.EndDate }
            };

            string encodedUrl = HttpHelper.BuildUrl(url, parameters);

            var rawResponse = Requestor.GetString(encodedUrl);

            return(Mapper <DwollaResponse <DwollaTransactionStats> > .MapFromJson(rawResponse));
        }
示例#10
0
        public virtual SearchResults <Transaction> Holds(
            int page         = 1,
            int pageSize     = 20,
            string accountId = null)
        {
            var url = Urls.Holds;

            url = ParameterBuilder.ApplyParameterToUrl(url, "page", page.ToString());
            url = ParameterBuilder.ApplyParameterToUrl(url, "page_size", pageSize.ToString());

            if (!string.IsNullOrEmpty(accountId))
            {
                url = ParameterBuilder.ApplyParameterToUrl(url, "account_id", accountId);
            }

            var response = Requestor.GetString(url, SecretKey);

            return(TransactionMapper.MapCollectionFromJson(response));
        }
示例#11
0
        /// <summary>
        /// Use this method to retrieve nearby Dwolla spots within the range of the
        /// provided lattitude and longitude. Halft of the limit are returned as
        /// spots with closest proximity. The other half of the spots returned
        /// as random spots within the range.
        /// </summary>
        /// <param name="key">Consumer key for the application</param>
        /// <param name="secret">Consumer secret for the application</param>
        /// <param name="latitude">Current lattitude</param>
        /// <param name="longitude">Current longitude</param>
        /// <param name="range">Range to retireve spots for (in miles), defaults to 10</param>
        /// <param name="limit">Number of spots to retrieve, defaults to 10</param>
        /// <returns></returns>
        public DwollaResponse <IList <DwollaContact> > GetNearbyContacts(string key, string secret,
                                                                         string latitude = null, string longitude = null, string range = null, string limit = null)
        {
            var parameters = new Dictionary <string, object>()
            {
                { "client_id", key },
                { "client_secret", secret },
                { "latitude", latitude },
                { "longitude", longitude },
                { "range", range },
                { "limit", limit }
            };

            var    endpoint   = string.Format("{0}/{1}", Urls.Contacts, "nearby");
            string encodedUrl = HttpHelper.BuildUrl(endpoint, parameters);

            var rawResponse = Requestor.GetString(encodedUrl);

            return(Mapper <DwollaResponse <IList <DwollaContact> > > .MapFromJson(rawResponse));
        }
示例#12
0
        /// <summary>
        /// Use this method to retrieve the contacts' information for the
        /// user associated with the authorized access token.
        /// </summary>
        /// <param name="oAuthToken">A valid OAuth token</param>
        /// <param name="search">Search term used to search the contacts</param>
        /// <param name="limit">Number of contacts to retrieve. Defaults to 25.</param>
        /// <param name="types">Account types to return, defaults to Dwolla and FB</param>
        /// <returns></returns>
        public DwollaResponse <IList <DwollaContact> > GetUserContacts(string oAuthToken,
                                                                       string search = null, string limit = "25", string types = "Dwolla,Facebook")
        {
            var parameters = new Dictionary <string, object>()
            {
                { "oauth_token", oAuthToken },
                { "types", types },
                { "limit", limit }
            };

            if (!string.IsNullOrWhiteSpace(search))
            {
                parameters.Add("search", search);
            }

            string encodedUrl = HttpHelper.BuildUrl(Urls.Contacts, parameters);

            string rawResponse = Requestor.GetString(encodedUrl);

            return(Mapper <DwollaResponse <IList <DwollaContact> > > .MapFromJson(rawResponse));
        }
示例#13
0
        public virtual TickerResponse GetTicker()
        {
            var result = JsonConvert.DeserializeObject <TickerResponse>(Requestor.GetString($"{Urls.Ticker}"));

            return(result);
        }
 public virtual StripeToken Get(string tokenId, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripeToken> .MapFromJson(Requestor.GetString(Urls.Tokens + "/" + tokenId, SetupRequestOptions(requestOptions))));
 }
示例#15
0
        public virtual StripeAccount Get()
        {
            var response = Requestor.GetString(Urls.Account, ApiKey);

            return(Mapper.MapFromJson <StripeAccount>(response));
        }
示例#16
0
 public virtual StripeRefund Get(string refundId, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripeRefund> .MapFromJson(Requestor.GetString(this.ApplyAllParameters(null, Urls.BaseUrl + "/refunds/" + refundId), SetupRequestOptions(requestOptions))));
 }
示例#17
0
        public virtual Models.Merchant GetMerchant()
        {
            var response = Requestor.GetString(Urls.Merchant, SecretKey);

            return(Mapper <Models.Merchant> .MapFromJson(response));
        }
 public virtual IEnumerable <StripeCustomer> List(StripeCustomerListOptions listOptions = null, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripeCustomer> .MapCollectionFromJson(Requestor.GetString(this.ApplyAllParameters(listOptions, Urls.Customers, isListMethod: true), SetupRequestOptions(requestOptions))));
 }
 public virtual StripeCustomer Get(string customerId, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripeCustomer> .MapFromJson(Requestor.GetString(this.ApplyAllParameters(null, Urls.Customers + "/" + customerId), SetupRequestOptions(requestOptions))));
 }
示例#20
0
        public virtual StripeBalance Get()
        {
            var response = Requestor.GetString(Urls.Balance, ApiKey);

            return(Mapper <StripeBalance> .MapFromJson(response));
        }
示例#21
0
        /// <summary>
        /// Begin a new synchronous GetCollaborator request
        /// </summary>
        /// <returns></returns>
        public GameSparksCollaborator GetCollaborator(string email)
        {
            var url = string.Format(Urls.CollboratorsWithEmail, email);

            return(JsonConvert.DeserializeObject <GameSparksCollaborator>(Requestor.GetString(url).ResponseJson));
        }
示例#22
0
 /// <summary>
 /// Begin a new synchronous GetCollaborators request
 /// </summary>
 /// <returns></returns>
 public GetCollaboratorsResponse GetCollaborators()
 {
     return(JsonConvert.DeserializeObject <GetCollaboratorsResponse>(Requestor.GetString(Urls.Collborators).ResponseJson));
 }
示例#23
0
 public List <GameSparksRepository> ListBitbucketRepositories()
 {
     return(JsonConvert.DeserializeObject <List <GameSparksRepository> >(Requestor.GetString(Urls.BitBucketListRepos).ResponseJson));
 }
示例#24
0
        public virtual TwentyFourHourVolumeResponse Get24HourVolume()
        {
            var result = JsonConvert.DeserializeObject <TwentyFourHourVolumeResponse>(Requestor.GetString($"{Urls.TwentyFourHourVolume}"));

            return(result);
        }