{ "info": { "author": "Francis Reyes", "author_email": "francis.reyes@tangentsnowball.com.au", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "=======================================\nPaymentExpress package for django-oscar\n=======================================\n\nThis package provides integration with the payment gateway, PaymentExpress using their `PX POST API`_. It is designed to work seamlessly with the e-commerce framework `django-oscar`_ but can be used without it.\n\n.. _`PX Post API`: http://sec.paymentexpress.com/technical_resources/ecommerce_nonhosted/pxpost.html\n.. _`django-oscar`: https://github.com/tangentlabs/django-oscar\n\nInstallation\n------------\n\nFrom PyPi::\n\n pip install django-oscar-paymentexpress\n\nor from Github::\n\n pip install git+git://github.com/tangentlabs/django-oscar-paymentexpress.git#egg=django-oscar-paymentexpress\n\nAdd ``'paymentexpress'`` to ``INSTALLED_APPS`` and run::\n\n ./manage.py migrate paymentexpress\n\nto create the appropriate database tables.\n\nConfiguration\n-------------\n\nEdit your ``settings.py`` to set the following settings::\n\n PAYMENTEXPRESS_POST_URL = 'https://sec.paymentexpress.com/pxpost.aspx'\n PAYMENTEXPRESS_USERNAME = '\u2026'\n PAYMENTEXPRESS_PASSWORD = '\u2026'\n PAYMENTEXPRESS_CURRENCY = 'AUD'\n\nIntegration into checkout\n-------------------------\n\nYou'll need to use a subclass of ``oscar.apps.checkout.views.PaymentDetailsView`` within your own\ncheckout views. See `oscar's documentation`_ on how to create a local version of the checkout app.\n\n.. _`oscar's documentation`: http://django-oscar.readthedocs.org/en/latest/index.html\n\nOverride the ``handle_payment`` method (which is blank by default) and add your integration code. An example\nintegration might look like::\n\n # myshop.checkout.views\n from django.conf import settings\n\n from oscar.apps.checkout.views import PaymentDetailsView as OscarPaymentDetailsView\n from oscar.apps.payment.forms import BankcardForm\n from paymentexpress.facade import Facade\n from paymentexpress import PAYMENTEXPRESS\n\n ...\n\n class PaymentDetailsView(OscarPaymentDetailsView):\n\n def get_context_data(self, **kwargs):\n ...\n ctx['bankcard_form'] = BankcardForm()\n ...\n return ctx\n\n def post(self, request, *args, **kwargs):\n \"\"\"\n This method is designed to be overridden by subclasses which will\n validate the forms from the payment details page. If the forms are valid\n then the method can call submit()\n \"\"\"\n # Check bankcard form is valid\n bankcard_form = BankcardForm(request.POST)\n if not bankcard_form.is_valid():\n ctx = self.get_context_data(**kwargs)\n ctx['bankcard_form'] = bankcard_form\n return self.render_to_response(ctx)\n\n bankcard = bankcard_form.get_bankcard_obj()\n\n # Call oscar's submit method, passing through the bankcard object so it gets\n # passed to the 'handle_payment' method\n return self.submit(request.basket, payment_kwargs={'bankcard': bankcard})\n\n def handle_payment(self, order_number, total, **kwargs):\n # Make request to PaymentExpress - if there any problems (eg bankcard\n # not valid / request refused by bank) then an exception would be\n # raised and handled) within oscar's PaymentDetails view.\n bankcard = kwargs['bankcard']\n response_dict = Facade().purchase(order_number, total, None, bankcard)\n\n source_type, _ = SourceType.objects.get_or_create(name=PAYMENTEXPRESS)\n source = Source(source_type=source_type,\n currency=settings.PAYMENTEXPRESS_CURRENCY,\n amount_allocated=total,\n amount_debited=total,\n reference=response_dict['partner_reference'])\n\n self.add_payment_source(source)\n\n # Also record payment event\n self.add_payment_event(PURCHASE, total)\n\nOscar's view will handle the various exceptions that can get raised.\n\nPackage structure\n=================\n\nThere are two key components:\n\nGateway\n-------\n\nThe class ``paymentexpress.gateway.Gateway`` provides fine-grained access to the PaymentExpress API, which involve constructing XML requests and decoding XML responses. All calls return a ``paymentexpress.gateway.Response`` instance which provides dictionary-like access to the attributes of the response.\n\nExample calls::\n\n # Authorise a transaction.\n # The funds are not transferred from the cardholder account.\n response = gateway.authorise(card_holder='John Smith',\n card_number='4500230021616301',\n cvc2='123',\n amount=50.23)\n\n # Completes (settles) a pre-approved Auth Transaction.\n response = gateway.complete(amount=50.23,\n dps_txn_ref='0000000809b61753')\n\n\n # Purchase on a new card - funds are transferred immediately\n response = gateway.purchase(card_holder='Frankie',\n card_number=CARD_VISA,\n card_expiry='1015',\n cvc2='123',\n merchant_ref='100001_PURCHASE_1_2008',\n enable_add_bill_card=1,\n amount=29.95)\n\n # Purchase on a previously used card\n response = gateway.purchase(amount=29.95,\n billing_id='0000080023748351')\n\n\n # Refund a transaction - funds are transferred immediately\n response = gateway.refund(dps_txn_ref='0000000809b61753',\n merchant_ref='abc123',\n amount=50.23)\n\nFacade\n------\n\nThe class ``paymentexpress.facade.Facade`` wraps the above gateway object and provides a less granular API, as well as saving instances of ``paymentexpress.models.OrderTransaction`` to provide an audit trail for PaymentExpress activity.\n\n\nSettings\n========\n\n* ``PAYMENTEXPRESS_POST_URL`` - PX POST URL\n\n* ``PAYMENTEXPRESS_USERNAME`` - Username\n\n* ``PAYMENTEXPRESS_PASSWORD`` - Password\n\n* ``PAYMENTEXPRESS_CURRENCY`` - Currency to use for transactions\n\n\nContributing\n============\n\nTo work on ``django-oscar-paymentexpress``, clone the repo, set up a virtualenv and install in develop mode::\n\n python setup.py develop\n\nthen install the testing dependencies::\n\n pip install -r requirements.txt\n\nThe test suite can then be run using::\n\n ./run_tests.py\n\nMagic card numbers are available on the PaymentExpress site:\nhttp://www.paymentexpress.com/knowledge_base/faq/developer_faq.html#Testing%20Details\n\nSample VISA vard:\n\n 4111111111111111", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tangentlabs/django-oscar-paymentexpress", "keywords": "Payment,PaymentExpress", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-oscar-paymentexpress", "package_url": "https://pypi.org/project/django-oscar-paymentexpress/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-oscar-paymentexpress/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/tangentlabs/django-oscar-paymentexpress" }, "release_url": "https://pypi.org/project/django-oscar-paymentexpress/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "PaymentExpress payment module for django-oscar", "version": "0.1.1" }, "last_serial": 790231, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "1b6ad8f6b7d3fbce8014ac8bdbdd3dfa", "sha256": "bc2c959dbbfcaf2565fc9a8f161bc7856fb18299c2eb7f028e041f0f10f88dc7" }, "downloads": -1, "filename": "django-oscar-paymentexpress-0.1.tar.gz", "has_sig": false, "md5_digest": "1b6ad8f6b7d3fbce8014ac8bdbdd3dfa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11478, "upload_time": "2012-08-15T04:41:42", "url": "https://files.pythonhosted.org/packages/0e/53/445f769d08d4f25613889cad5b8671b19ad6f592e24159fab51001022590/django-oscar-paymentexpress-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "3c976dfb7f993d8899356e77a334cbd7", "sha256": "c428ef7527e6445cb267bf1de8354e11dd520b740b59e81434b7be279c01c6aa" }, "downloads": -1, "filename": "django-oscar-paymentexpress-0.1.1.tar.gz", "has_sig": false, "md5_digest": "3c976dfb7f993d8899356e77a334cbd7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11491, "upload_time": "2012-08-29T07:29:44", "url": "https://files.pythonhosted.org/packages/b9/6c/d903fe8d60cd68cdf3693496a455cd2dae3840e406bfa185f8e45da51f90/django-oscar-paymentexpress-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3c976dfb7f993d8899356e77a334cbd7", "sha256": "c428ef7527e6445cb267bf1de8354e11dd520b740b59e81434b7be279c01c6aa" }, "downloads": -1, "filename": "django-oscar-paymentexpress-0.1.1.tar.gz", "has_sig": false, "md5_digest": "3c976dfb7f993d8899356e77a334cbd7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11491, "upload_time": "2012-08-29T07:29:44", "url": "https://files.pythonhosted.org/packages/b9/6c/d903fe8d60cd68cdf3693496a455cd2dae3840e406bfa185f8e45da51f90/django-oscar-paymentexpress-0.1.1.tar.gz" } ] }