Beispiel #1
0
        /// <summary>
        /// Cancel Settlement
        /// </summary>
        /// <param name="settlement">Settlement</param>
        /// <returns>Settlement</returns>
        public Settlement cancelSettlement(Settlement settle)
        {
            settle.setRequiredFields(new List <string> {
                CardPaymentsConstants.id
            });
            settle.checkRequiredFields();

            Settlement tmpSettlement = new Settlement();

            tmpSettlement.status("CANCELLED");

            Request request = new Request(
                method: RequestType.PUT,
                uri: this.prepareURI("/settlements/" + settle.id()),
                body: tmpSettlement
                );

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

            return(new Settlement(response));
        }
Beispiel #2
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: PrepareUri("/settlements"),
                queryString: queryStr
                );

            dynamic response = _client.ProcessRequest(request);

            return(new Pagerator <Settlement>(_client, typeof(Settlement), response));
        }
Beispiel #3
0
        /// <summary>
        /// Settlement
        /// </summary>
        /// <param name="settlement">Settlement</param>
        /// <returns>Settlement</returns>
        public Settlement Settlement(Settlement settle)
        {
            settle.SetRequiredFields(new List <string> {
                GlobalConstants.AuthorizationId
            });
            settle.CheckRequiredFields();
            settle.SetRequiredFields(new List <string> {
                GlobalConstants.MerchantRefNum
            });
            settle.SetOptionalFields(new List <string> {
                GlobalConstants.Amount,
                GlobalConstants.DupCheck
            });

            Request request = new Request(
                method: RequestType.Post,
                uri: PrepareUri("/auths/" + settle.AuthorizationId() + "/settlements"),
                body: settle
                );

            dynamic response = _client.ProcessRequest(request);

            return(new Settlement(response));
        }
Beispiel #4
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));
        }