예제 #1
0
        public BaseResponse <ListChargesResponse, ErrorsResponse> ListCharges(ListChargesRequest request)
        {
            var method   = HttpMethod.Get;
            var endpoint = $"/charges";
            var query    = request.ToDictionary();

            return(this.SendRequest <ListChargesResponse>(method, endpoint, null, query));
        }
        public void ListChages_PagedBefore_Success()
        {
            _createChargeRequest.CardDetails = _workingCard;
            Charge             createChargeResponse = _service.CreateCharge(_createChargeRequest).Content;
            ListChargesRequest request      = new ListChargesRequest();
            DateTime           beforeFilter = DateTime.Now.ToUniversalTime();

            request.Before = beforeFilter;

            PagedApiResponse <Charge> charges = _service.ListCharges(request);

            Assert.IsFalse(charges.IsError);
            Assert.IsFalse(charges.Content.Any(c => c.Id == createChargeResponse.Id)); // charge should be missing because of pagination
        }
        public void ListCharges_Success()
        {
            _createChargeRequest.CardDetails = _workingCard;
            Charge createChargeResponse = _service.CreateCharge(_createChargeRequest).Content;

            _service.CreateCharge(_createChargeRequest);
            _service.CreateCharge(_createChargeRequest);

            ListChargesRequest        request = new ListChargesRequest();
            PagedApiResponse <Charge> charges = _service.ListCharges(request);

            Assert.IsFalse(charges.IsError);
            Assert.IsTrue(charges.Content.Count >= 3);
        }
        public PagedApiResponse <Charge> ListCharges(ListChargesRequest request)
        {
            PagedApiResponse <Charge> response = GetPagedApiResponse <ListChargesRequest, Charge>(request);

            return(response);
        }