@@ -737,12 +737,12 @@ def retrieve(cls, charge_id=None):
737737 return _as_object (cls ._request ('get' , cls ._collection_path ()))
738738
739739 @classmethod
740- def list (cls ):
740+ def list (cls , ** kwargs ):
741741 """Return all charges that belongs to your account
742742
743743 :rtype: LazyCollection
744744 """
745- return LazyCollection (cls ._collection_path ())
745+ return LazyCollection (cls ._collection_path (), fromDate = kwargs . pop ( 'fromDate' , None ), toDate = kwargs . pop ( 'toDate' , None ) )
746746
747747 def reload (self ):
748748 """Reload the charge details.
@@ -1050,9 +1050,12 @@ def schedule(self):
10501050
10511051class LazyCollection (object ):
10521052 """Proxy class representing a lazy collection of items."""
1053- def __init__ (self , collection_path ):
1053+
1054+ def __init__ (self , collection_path , ** kwargs ):
10541055 self .collection_path = collection_path
10551056 self ._exhausted = False
1057+ self .fromDate = kwargs .pop ('fromDate' , None )
1058+ self .toDate = kwargs .pop ('toDate' , None )
10561059
10571060 def __len__ (self ):
10581061 return self ._fetch_objects (limit = 1 , offset = 0 )['total' ]
@@ -1104,14 +1107,18 @@ def _update_listing(self, data):
11041107
11051108 def _fetch_objects (self , ** kwargs ):
11061109 order = kwargs .pop ('order' , None )
1110+ fromDate = self .fromDate
1111+ toDate = self .toDate
11071112
11081113 return Request (api_secret , api_main , api_version ).send (
11091114 'get' ,
11101115 self .collection_path ,
11111116 payload = {
11121117 'limit' : kwargs ['limit' ],
11131118 'offset' : kwargs ['offset' ],
1114- 'order' : order
1119+ 'order' : order ,
1120+ 'from' : fromDate ,
1121+ 'to' : toDate
11151122 }
11161123 )
11171124
0 commit comments