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 1e96fdd..bfa2919 100644 --- a/README.rst +++ b/README.rst @@ -2,10 +2,21 @@ 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 + +.. 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 +Oscar 0.7+. .. _`Adyen`: http://www.adyen.com/ .. _`django-oscar`: https://github.com/tangentlabs/django-oscar @@ -19,22 +30,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 +60,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. 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/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', 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 97% rename from adyen/tests.py rename to tests/test_adyen.py index 3d27bfb..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' @@ -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',