diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index d850f7f..435cdde 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -7,16 +7,17 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.11"] + python-version: ["3.13"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip .[tests] + pip install setuptools - name: Run Test run: coverage run -m unittest - name: Generate report diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index baa044c..382f741 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,10 +10,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: 3.9 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5f28ca1..9363c44 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,11 +9,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/omise/__init__.py b/omise/__init__.py index 810ef9c..2d7c4a6 100644 --- a/omise/__init__.py +++ b/omise/__init__.py @@ -737,12 +737,12 @@ def retrieve(cls, charge_id=None): return _as_object(cls._request('get', cls._collection_path())) @classmethod - def list(cls): + def list(cls, **kwargs): """Return all charges that belongs to your account :rtype: LazyCollection """ - return LazyCollection(cls._collection_path()) + return LazyCollection(cls._collection_path(), fromDate=kwargs.pop('fromDate', None), toDate=kwargs.pop('toDate', None)) def reload(self): """Reload the charge details. @@ -1050,9 +1050,12 @@ def schedule(self): class LazyCollection(object): """Proxy class representing a lazy collection of items.""" - def __init__(self, collection_path): + + def __init__(self, collection_path, **kwargs): self.collection_path = collection_path self._exhausted = False + self.fromDate = kwargs.pop('fromDate', None) + self.toDate = kwargs.pop('toDate', None) def __len__(self): return self._fetch_objects(limit=1, offset=0)['total'] @@ -1104,6 +1107,8 @@ def _update_listing(self, data): def _fetch_objects(self, **kwargs): order = kwargs.pop('order', None) + fromDate = self.fromDate + toDate = self.toDate return Request(api_secret, api_main, api_version).send( 'get', @@ -1111,7 +1116,9 @@ def _fetch_objects(self, **kwargs): payload={ 'limit': kwargs['limit'], 'offset': kwargs['offset'], - 'order': order + 'order': order, + 'from': fromDate, + 'to': toDate } ) diff --git a/setup.py b/setup.py index d69bb77..f4b2e2e 100644 --- a/setup.py +++ b/setup.py @@ -40,5 +40,9 @@ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Libraries :: Python Modules", ]) diff --git a/tox.ini b/tox.ini index 4cf9fce..f4ae801 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,9 @@ [tox] -envlist = py27, py37, py38, py39, py310, py311 +envlist = py27, py37, py38, py39, py310, py311, py312, py313 [testenv] +deps = + setuptools commands = pip install ".[tests]" python -m unittest