From 943d1ef44a8185075e816588fb952b44fd7686bf Mon Sep 17 00:00:00 2001 From: Nicolas Dubois Date: Wed, 22 Apr 2015 09:52:49 +0200 Subject: [PATCH 1/4] Update README file with license and PyPI badges (version/py_version) I reformatted the `settings` section, to display vars as a table. I also put `code-block` directives for snippets. --- README.rst | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index 1e96fdd..ab849f9 100644 --- a/README.rst +++ b/README.rst @@ -2,10 +2,18 @@ Adyen package for django-oscar ============================== -This package provides integration with the `Adyen`_ payment gateway. It is designed to -work seamlessly with the e-commerce framework `django-oscar`_ but can be used without -Oscar. -This extension supports Django 1.6+, Python 3.3+ and Oscar 0.7+. +.. image:: https://pypip.in/version/django-oscar-adyen/badge.svg + :target: https://pypi.python.org/pypi/django-oscar-adyen/ + :alt: Latest Version + +.. image:: https://pypip.in/py_versions/django-oscar-adyen/badge.svg + :target: https://pypi.python.org/pypi/django-oscar-adyen/ + :alt: Supported Python versions + +This package provides integration with the `Adyen`_ payment gateway. It is +designed to work seamlessly with the e-commerce framework `django-oscar`_ but +can be used without Oscar. This extension supports Django 1.6+, Python 3.3+ and +Oscar 0.7+. .. _`Adyen`: http://www.adyen.com/ .. _`django-oscar`: https://github.com/tangentlabs/django-oscar @@ -19,22 +27,24 @@ Installation From PyPi:: - pip install django-oscar-adyen + $ pip install django-oscar-adyen or from Github:: - pip install git+git://github.com/oscaro/django-oscar-adyen.git#egg=django-oscar-adyen + $ pip install git+git://github.com/oscaro/django-oscar-adyen.git#egg=django-oscar-adyen Add ``'adyen'`` to ``INSTALLED_APPS`` and run:: - ./manage.py migrate adyen + $ django-admin migrate adyen to create the appropriate database tables. Configuration ------------- -Edit your ``settings.py`` to set the following settings:: +Edit your ``settings.py`` to set the following settings: + +.. code-block:: python ADYEN_IDENTIFIER = 'YourAdyenAccountName' ADYEN_SECRET_KEY = 'YourAdyenSkinSecretKey' @@ -47,8 +57,16 @@ as opposed to your production environment. Settings ======== -* ``ADYEN_IDENTIFIER`` - The identifier of your Adyen account. +====================== ========================================================= + Setting Description +---------------------- --------------------------------------------------------- + ``ADYEN_IDENTIFIER`` The identifier of your Adyen account + ``ADYEN_SECRET_KEY`` The secret key defined in your Adyen skin + ``ADYEN_ACTION_URL`` The URL towards which the Adyen form should be POSTed + to initiate the payment process +====================== ========================================================= -* ``ADYEN_SECRET_KEY`` - The secret key defined in your Adyen skin. +License +======= -* ``ADYEN_ACTION_URL`` - The URL towards which the Adyen form should be POSTed to initiate the payment process. +``django-oscar-adyen`` is released under the BSD license, like Django itself. From 3b0b4520d708226d78fa16ccd580d1d9ff45be43 Mon Sep 17 00:00:00 2001 From: Nicolas Dubois Date: Wed, 29 Apr 2015 01:59:53 +0200 Subject: [PATCH 2/4] =?UTF-8?q?Use=20`example.com`=20for=20URLs=20and=20em?= =?UTF-8?q?ails=20=E2=80=A2=20Add=20country=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The key `merchantSig` has been updated accordingly. --- adyen/tests.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/adyen/tests.py b/adyen/tests.py index 3d27bfb..2d3d054 100644 --- a/adyen/tests.py +++ b/adyen/tests.py @@ -23,7 +23,7 @@ TEST_SKIN_CODE = 'cqQJKZpg' TEST_IP_ADDRESS_HTTP_HEADER = 'HTTP_X_FORWARDED_FOR' -TEST_RETURN_URL = 'https://www.test.com/checkout/return/adyen/' +TEST_RETURN_URL = 'https://www.example.com/checkout/return/adyen/' TEST_FROZEN_TIME = '2014-07-31 17:00:00' @@ -32,15 +32,16 @@ {'type': 'hidden', 'name': 'merchantAccount', 'value': TEST_IDENTIFIER}, {'type': 'hidden', 'name': 'merchantReference', 'value': '00000000123'}, {'type': 'hidden', 'name': 'merchantReturnData', 'value': 123}, - {'type': 'hidden', 'name': 'merchantSig', 'value': 'mCCvOn8nc4vdo5w2pUJ9u+mV7Gg='}, + {'type': 'hidden', 'name': 'merchantSig', 'value': 'kKvzRvx7wiPLrl8t8+owcmMuJZM='}, {'type': 'hidden', 'name': 'paymentAmount', 'value': 123}, {'type': 'hidden', 'name': 'resURL', 'value': TEST_RETURN_URL}, {'type': 'hidden', 'name': 'sessionValidity', 'value': '2014-07-31T17:20:00Z'}, {'type': 'hidden', 'name': 'shipBeforeDate', 'value': '2014-08-30'}, - {'type': 'hidden', 'name': 'shopperEmail', 'value': 'test@test.com'}, + {'type': 'hidden', 'name': 'shopperEmail', 'value': 'test@example.com'}, {'type': 'hidden', 'name': 'shopperLocale', 'value': 'fr'}, {'type': 'hidden', 'name': 'shopperReference', 'value': 789}, {'type': 'hidden', 'name': 'skinCode', 'value': 'cqQJKZpg'}, + {'type': 'hidden', 'name': 'countryCode', 'value': 'fr'}, ] AUTHORISED_PAYMENT_PARAMS_GET = { @@ -116,9 +117,10 @@ def setUp(self): self.order_data = { 'amount': 123, 'basket_id': 456, - 'client_email': 'test@test.com', + 'client_email': 'test@example.com', 'client_id': 789, 'currency_code': 'EUR', + 'country_code': 'fr', 'description': 'Order #123', 'order_id': 'ORD-123', 'order_number': '00000000123', From eea6c958efdca6f626e02db1de99f4bf91f66bfc Mon Sep 17 00:00:00 2001 From: Nicolas Dubois Date: Wed, 29 Apr 2015 02:05:42 +0200 Subject: [PATCH 3/4] Add Travis CI and a minimal test project to run tests I also moved adyen/tests.py to tests/test_adyen.py. --- .travis.yml | 14 ++++++++++++++ README.rst | 3 +++ pytest.ini | 12 ++++++++++++ tests/__init__.py | 0 tests/settings.py | 23 +++++++++++++++++++++++ adyen/tests.py => tests/test_adyen.py | 8 ++++---- 6 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 .travis.yml create mode 100644 pytest.ini create mode 100644 tests/__init__.py create mode 100644 tests/settings.py rename adyen/tests.py => tests/test_adyen.py (99%) diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..db2b0a1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: python + +python: + - "3.3" + - "3.4" + +install: + - pip install 'django-oscar>=0.7' + - pip install -r requirements.txt + +env: + - PYTHONPATH=.:$PYTHONPATH + +script: py.test tests diff --git a/README.rst b/README.rst index ab849f9..bfa2919 100644 --- a/README.rst +++ b/README.rst @@ -10,6 +10,9 @@ Adyen package for django-oscar :target: https://pypi.python.org/pypi/django-oscar-adyen/ :alt: Supported Python versions +.. image:: https://api.travis-ci.org/oscaro/django-oscar-adyen.svg + :target: https://travis-ci.org/oscaro/django-oscar-adyen + This package provides integration with the `Adyen`_ payment gateway. It is designed to work seamlessly with the e-commerce framework `django-oscar`_ but can be used without Oscar. This extension supports Django 1.6+, Python 3.3+ and diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..0d4c31f --- /dev/null +++ b/pytest.ini @@ -0,0 +1,12 @@ +[pytest] +DJANGO_SETTINGS_MODULE=tests.settings +addopts = --pyargs --reuse-db + +; Imitate Django's test discovery pattern. py.test's default is test_*.py +python_files=test*.py + +flakes-ignore = + migrations/* ALL + +; new pep8 relaxed rules +pep8maxlinelength = 100 diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/settings.py b/tests/settings.py new file mode 100644 index 0000000..a4e9088 --- /dev/null +++ b/tests/settings.py @@ -0,0 +1,23 @@ +# """ +# Django settings for tests project. +# """ + +import os +BASE_DIR = os.path.dirname(os.path.dirname(__file__)) + +SECRET_KEY = '+&l^d!%soa4gxsnx7_txbo0x3uv$@4i&n!r8yte72otwqo7vmh' + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + +OSCAR_DEFAULT_CURRENCY = 'EUR' + +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', +) + +INSTALLED_APPS = ('adyen',) diff --git a/adyen/tests.py b/tests/test_adyen.py similarity index 99% rename from adyen/tests.py rename to tests/test_adyen.py index 2d3d054..f124baf 100644 --- a/adyen/tests.py +++ b/tests/test_adyen.py @@ -11,10 +11,10 @@ from freezegun import freeze_time -from .gateway import MissingFieldException, InvalidTransactionException -from .models import AdyenTransaction -from .scaffold import Scaffold -from .facade import Facade +from adyen.gateway import MissingFieldException, InvalidTransactionException +from adyen.models import AdyenTransaction +from adyen.scaffold import Scaffold +from adyen.facade import Facade TEST_IDENTIFIER = 'OscaroFR' From 4e25149b8575fd733598f8b63f20c8afde9bb851 Mon Sep 17 00:00:00 2001 From: Nicolas Dubois Date: Thu, 23 Apr 2015 01:07:11 +0200 Subject: [PATCH 4/4] Bump version number to 0.2.6 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a4d1489..c87d3e7 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ setup( name='django-oscar-adyen', - version='0.2.5', + version='0.2.6', url='https://github.com/oscaro/django-oscar-adyen', author='Mathieu Richardoz', author_email='mr@babik.fr',