Ejemplo n.º 1
0
        /// <summary>
        /// Create get
        /// </summary>
        /// <param name="get">get</param>
        /// <returns>Purchases</returns>
        public Purchases get(Purchases purchase)
        {
            purchase.setRequiredFields(new List <string> {
                DirectDebitConstants.id,
            });
            purchase.checkRequiredFields();
            purchase.setOptionalFields(new List <string> {
                DirectDebitConstants.ach,
                DirectDebitConstants.bacs,
                DirectDebitConstants.eft,
                DirectDebitConstants.sepa,
            });

            Request request = new Request(
                method: RequestType.GET,
                uri: this.prepareURI(client.account() + "/purchases/" + purchase.id()),
                body: purchase
                );
            dynamic response = this.client.processRequest(request);

            return(new Purchases(response));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get matching Purchases
        /// </summary>
        /// <param name="purchases"></param>
        /// <param name="filter"></param>
        /// <returns></returns>
        public Pagerator <Purchases> getPurchase(Purchases purchases = null, Filter filter = null)
        {
            Dictionary <String, String> queryStr = new Dictionary <String, String>();

            if (purchases != null && !String.IsNullOrWhiteSpace(purchases.merchantRefNum()))
            {
                queryStr.Add("merchantRefNum", purchases.merchantRefNum());
            }
            if (filter != null)
            {
                if (filter.limit != null)
                {
                    queryStr.Add("limit", filter.limit.ToString());
                }
                if (filter.offset != null)
                {
                    queryStr.Add("offset", filter.offset.ToString());
                }
                if (!String.IsNullOrWhiteSpace(filter.startDate))
                {
                    queryStr.Add("startDate", filter.startDate);
                }
                if (!String.IsNullOrWhiteSpace(filter.endDate))
                {
                    queryStr.Add("endDate", filter.endDate);
                }
            }

            Request request = new Request(
                method: RequestType.GET,
                uri: this.prepareURI(client.account() + "/purchases"),
                queryString: queryStr
                );

            dynamic response = this.client.processRequest(request);

            return(new Pagerator <Purchases>(this.client, typeof(Purchases), response));
        }