Beispiel #1
0
        /// <summary>
        /// Get matching settlements
        /// </summary>
        /// <param name="settlement"></param>
        /// <param name="filter"></param>
        /// <returns></returns>
        public Pagerator <Settlement> getSettlements(Settlement settlement = null, Filter filter = null)
        {
            Dictionary <String, String> queryStr = new Dictionary <String, String>();

            if (settlement != null && !String.IsNullOrWhiteSpace(settlement.merchantRefNum()))
            {
                queryStr.Add("merchantRefNum", settlement.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("/settlements"),
                queryString: queryStr
                );

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

            return(new Pagerator <Settlement>(this.client, typeof(Settlement), response));
        }
Beispiel #2
0
        /// <summary>
        /// Settlement
        /// </summary>
        /// <param name="settlement">Settlement</param>
        /// <returns>Settlement</returns>
        public Settlement settlement(Settlement settle)
        {
            settle.setRequiredFields(new List <string> {
                CardPaymentsConstants.authorizationId
            });
            settle.checkRequiredFields();
            settle.setRequiredFields(new List <string> {
                CardPaymentsConstants.merchantRefNum
            });
            settle.setOptionalFields(new List <string> {
                CardPaymentsConstants.amount,
                CardPaymentsConstants.dupCheck
            });

            Request request = new Request(
                method: RequestType.POST,
                uri: this.prepareURI("/auths/" + settle.authorizationId() + "/settlements"),
                body: settle
                );

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

            return(new Settlement(response));
        }