diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..738f2ea --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +# see: https://github.com/direnv/direnv/wiki/Python#venv-stdlib-module +layout python-venv python3.6 diff --git a/.gitignore b/.gitignore index 3ea6c26..250294f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Python -.env +.direnv/ *.pyc __pycache__ *.egg-info diff --git a/.travis.yml b/.travis.yml index f8bc919..529f268 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,32 @@ +dist: xenial + +sudo: false + language: python -matrix: + +python: + - 3.6 + - 3.7 + +install: pip install tox-travis + +script: tox + +stages: + - test + - name: deploy + if: tag IS present + +jobs: include: - - python: '3.5' - env: TOXENV=py35-django207-test - - python: '3.6' - env: TOXENV=py36-django207-test - - python: '3.5' - env: TOXENV=py35-django207-checkmigrations - - python: '3.5' - env: TOXENV=py35-django207-flake -install: -- pip install tox -script: -- tox -deploy: - provider: pypi - user: skioo - password: - secure: TLVygdPWAdjyqMpcQoNMUGfsf2OTouc2FygktGIkSH86jj4nwsHFEvELtscoNwXbDABWt6mC1k9zvTFCWrH718FQgoZmLZw59sWNNaXnYCmCgeU2lxOsg5V8D0bLVgV7bheJ9kPCa6tphaop8R+fmCQht50wWDhXS9AK51EucspffEL1OaUbShhteUkJXctadn+P3KaFWEJBGX+AJyCsCxtTYlN9EzHbil6SPpSddthiqiGSg3KBdxKeKlB+B4rP+e7PQGnEE4TPGS293DZDDo8yLzJi4YDtCpjQDuOxFMyWskzj21WlLMY5UW8rqMydMY/OTyfRdUYZXvcl9GGBFMc/ZgMsI5vcdCRbOMsBdOg1mMiuw6IWwuAAU0eNn10IE3E56AxiRDK4W8V7B5qTk60zHQbYb8K3nxXl8y+lFL0oy0EX/JwX8ECnb1Dpc+MWVawrAQAPAQuR/Y+JZhmycKwI0qxe3957HS1zeVgB3SMT62c+as1wvRu11o+DZfSn4qMq+QzjFpcQLqriSjPSzRGHO41py7leNRtyxBmnBFKzLkVCzNjRvgrrFn5i5YZnYmV826umQNh0khC7w3S5Eh46w1pfnfNlFcUUtEiapKZdXrJVaTgIYHa06acgjEFZMzXDUsFFRk4LTbIrV2zJq/td0X9F4foCnbbj6CvWSmg= - distribution: sdist bdist_wheel - on: - tags: true + - stage: deploy + install: skip + script: skip + deploy: + provider: pypi + user: skioo + password: + secure: TLVygdPWAdjyqMpcQoNMUGfsf2OTouc2FygktGIkSH86jj4nwsHFEvELtscoNwXbDABWt6mC1k9zvTFCWrH718FQgoZmLZw59sWNNaXnYCmCgeU2lxOsg5V8D0bLVgV7bheJ9kPCa6tphaop8R+fmCQht50wWDhXS9AK51EucspffEL1OaUbShhteUkJXctadn+P3KaFWEJBGX+AJyCsCxtTYlN9EzHbil6SPpSddthiqiGSg3KBdxKeKlB+B4rP+e7PQGnEE4TPGS293DZDDo8yLzJi4YDtCpjQDuOxFMyWskzj21WlLMY5UW8rqMydMY/OTyfRdUYZXvcl9GGBFMc/ZgMsI5vcdCRbOMsBdOg1mMiuw6IWwuAAU0eNn10IE3E56AxiRDK4W8V7B5qTk60zHQbYb8K3nxXl8y+lFL0oy0EX/JwX8ECnb1Dpc+MWVawrAQAPAQuR/Y+JZhmycKwI0qxe3957HS1zeVgB3SMT62c+as1wvRu11o+DZfSn4qMq+QzjFpcQLqriSjPSzRGHO41py7leNRtyxBmnBFKzLkVCzNjRvgrrFn5i5YZnYmV826umQNh0khC7w3S5Eh46w1pfnfNlFcUUtEiapKZdXrJVaTgIYHa06acgjEFZMzXDUsFFRk4LTbIrV2zJq/td0X9F4foCnbbj6CvWSmg= + distribution: sdist bdist_wheel + on: + tags: true diff --git a/README.md b/README.md index 03af08e..d83f27a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,16 @@ django-netaxept-gateway ======================= -Tested on python 3.5 and django 2.0.7 +[![Build Status](https://travis-ci.org/skioo/django-netaxept-gateway.svg?branch=master)](https://travis-ci.org/skioo/django-netaxept-gateway) +[![PyPI version](https://badge.fury.io/py/django-netaxept-gateway.svg)](https://badge.fury.io/py/django-netaxept-gateway) +[![Requirements Status](https://requires.io/github/skioo/django-netaxept-gateway/requirements.svg?branch=master)](https://requires.io/github/skioo/django-netaxept-gateway/requirements/?branch=master) +[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) + +Requirements +------------ + +* Python: 3.6 and over +* Django: 2.0 and over Installation @@ -62,8 +71,18 @@ TODO - On prod (where debug is turned off), errors in the admin after invoking the gateway are shown as a useless grey page. -To work on this code --------------------- +Development +----------- + +To install all dependencies: pip install -e . + +To run tests: + + pip install pytest-django + pytest + + + diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..af2051c --- /dev/null +++ b/mypy.ini @@ -0,0 +1,5 @@ +[mypy] +ignore_missing_imports = True + +[mypy-netaxept.migrations.*] +ignore_errors = True diff --git a/netaxept/__init__.py b/netaxept/__init__.py index c276aa6..abf5976 100644 --- a/netaxept/__init__.py +++ b/netaxept/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.0.2' +__version__ = '0.2.0' __copyright__ = 'Copyright (c) 2018, skioo SA' __license__ = 'MIT' __URL__ = 'https://github.com/skioo/django-netaxept-gateway' diff --git a/netaxept/admin.py b/netaxept/admin.py index f065cf5..b19e1ef 100644 --- a/netaxept/admin.py +++ b/netaxept/admin.py @@ -20,7 +20,7 @@ def link_to_payment(obj): text) -link_to_payment.short_description = 'Payment' +link_to_payment.short_description = 'Payment' # type: ignore @admin.register(Operation) @@ -176,7 +176,7 @@ def auth_button(self, obj): else: return '-' - auth_button.short_description = 'Auth' + auth_button.short_description = 'Auth' # type: ignore def capture_button(self, obj): if obj.success: @@ -185,7 +185,7 @@ def capture_button(self, obj): else: return '-' - capture_button.short_description = 'Capture' + capture_button.short_description = 'Capture' # type: ignore def credit_button(self, obj): if obj.success: @@ -194,4 +194,4 @@ def credit_button(self, obj): else: return '-' - credit_button.short_description = 'Credit' + credit_button.short_description = 'Credit' # type: ignore diff --git a/setup.cfg b/setup.cfg index c9ae4a0..3fe65aa 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,4 +1,4 @@ [flake8] -exclude = .git, .tox, .env, */migrations/* +exclude = .git, .tox, .direnv, */migrations/* max-line-length = 119 diff --git a/setup.py b/setup.py index 9e1da81..d433afd 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ url=netaxept.__URL__, download_url='https://pypi.python.org/pypi/django-datatrans-gateway', install_requires=[ - 'Django>=2.0', + 'Django>=2.0,<2.2', 'structlog', 'suds2', 'requests', @@ -36,7 +36,7 @@ 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', ], ) diff --git a/tests/settings.py b/tests/settings.py index 7fe0c16..70bbe40 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -15,6 +15,8 @@ ] INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', 'django.contrib.contenttypes', 'netaxept', 'tests', diff --git a/tox.ini b/tox.ini index fa5858a..9565bbc 100644 --- a/tox.ini +++ b/tox.ini @@ -1,21 +1,23 @@ [tox] envlist = - {py35,py36}-{django207}-test - py35-django202-{checkmigrations,flake,mypy} + {py36,py37}-{django20, django21}-test + py37-django21-{checkmigrations,flake,mypy} [testenv] basepython = - py35: python3.5 py36: python3.6 + py37: python3.7 commands = test: py.test tests checkmigrations: ./manage.py makemigrations --check --dry-run flake: flake8 + mypy: mypy . deps = - django207: Django>=2.0.7,<2.1 + django20: Django>=2.0,<2.1 + django21: Django>=2.1,<2.2 structlog suds2 requests pytest-django - flake: flake8 + flake8 mypy