{ "info": { "author": "Creative Media", "author_email": "webmaster@creativemedia.ucdavis.edu", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "Django Touchnet\n===============\n\nDjango app for Touchnet integration built for KDVS Fundraiser based on Ecollege.\n\nOverview\n--------\n\nEach payment is associated with a ``transaction_id`` that can be any string \nwithout whitespace but is typically a primary key.\n\nThe app includes a basic template tag that has a form with Bootstrap classes \nthat can be used to redirect to Touchnet.\n\nThere are two signals for ``payment_received`` and ``payment_cancelled`` that \nwill trigger on postbacks from Touchnet.\n\nThe ``PostbackLog`` model stores all transactions, what was received and \nreturned, and is registered in the admin.\n\nThe test card is `5454545454545454` for Mastercard.\n\nInstallation\n------------\n\nDownload from Bitbucket and install in virtual environment with ``pip install django-touchnet-x.x.tar.gz``.\n\nConfiguration\n-------------\n\nInclude in ``INSTALLED_APPS``::\n\n INSTALLED_APPS = (\n ...\n 'touchnet',\n ...\n )\n\nInclude the required settings in your base settings, for example for development::\n\n TOUCHNET = {\n 'accounting': {\n 'fid': '117', # FID number for account\n 'fau': '3804148111300', # FAU number for account\n },\n 'posting_key': 'CM-KDVS-jfeiowajfiewao', # Random posting key for site in Touchnet Test\n 'site_id': '24', # Site id in Touchnet Test\n 'url': 'https://secure.touchnet.com:8443/C21642test_upay/web/index.jsp', # Touchnet Test endpoint\n }\n \nAnd similarly for production settings::\n\n TOUCHNET = {\n 'accounting': {\n 'fid': '117',\n 'fau': '3804148111300',\n },\n 'posting_key': 'CM-KDVS-jfeaiwjfeioaw',\n 'site_id': '17',\n 'url': 'https://marketplace.ucdavis.edu/C21642_upay/web/index.jsp', # Production Touchnet endpoint\n }\n\nInclude the URLs for postback in your ``urls.py``::\n\n urlpatterns = patterns('',\n ...\n url(r'^touchnet/', include('touchnet.urls')),\n ...\n )\n \nAlso include URLs for success, error, and cancel redirects back, e.g.::\n\n urlpatterns = patterns('fundraiser.views',\n ...\n url(r'^donate/success/$', 'donate_success_detail',\n name='fundraiser_donate_success_detail'), # Touchnet success\n url(r'^donate/error/$', 'donate_error_detail', \n name='fundraiser_donate_error_detail'), # Touchnet error\n url(r'^donate/cancel/$', 'donate_cancel_detail',\n name='fundraiser_donate_cancel_detail'), # Touchnet cancel\n ...\n )\n\nFinally, log into Touchnet and verify the postback URL, posting key, success \nURL, error URL, and cancel URL settings match. The postback URL should end in\n``/touchnet/postback``, e.g. ``https://fundraiser.kdvs.org/touchnet/postback``. \nThe URL must be ``https`` and the SSL certificate and IP address of the server \nmust be allowed by Touchnet.\n\nUsage\n-----\n\nTo process payments, connect receivers to signals in ``models.py``, optionally\nconnect one for cancellations e.g.::\n\n # Receivers\n\n def received_payment(sender, **kwargs):\n amount = kwargs['amount']\n transaction_id = kwargs['transaction_id']\n \n pledge = Pledge.objects.get(pk=transaction_id)\n pledge.amount_paid = amount\n pledge.save()\n payment_received.connect(received_payment, dispatch_uid='fundraiser_received_payment')\n\n def received_cancellation(sender, **kwargs):\n transaction_id = kwargs['transaction_id']\n \n pledge = Pledge.objects.get(pk=transaction_id)\n pledge.timestamp_cancelled = timezone.now()\n pledge.save()\n payment_cancelled.connect(received_cancellation, dispatch_uid='fundraiser_received_cancellation')\n \n\nTo redirect to Touchnet, create a ``touchnet.forms.RedirectForm`` with a \ntransaction id (e.g. pledge pk) and an amount (e.g. donation_amount) in a view::\n\n def donate_redirect_detail(request):\n context = {}\n pledge_pk = request.session['pledge']\n pledge = Pledge.objects.get(pk=pledge_pk)\n context['redirect_form'] = RedirectForm(pledge.pk, pledge.donation_amount)\n return render(request, 'fundraiser/donate_redirect_detail.html', context)\n \nAnd show the form in a template, optionally submitting it automatically. If \nusing Bootstrap, use the ``show_redirect_form`` template tag::\n\n {% extends 'core/base.html' %}\n\n {% load touchnet_extras %}\n\n {% block page-title %}Payment{% endblock %}\n {% block donate-status %}active{% endblock %}\n\n {% block content %}\n

Continue To Payment

\n

You will be redirected to a third-party payment site.

\n {% show_redirect_form redirect_form %}\n {% endblock %}\n\n {% block scripts %}\n \n {% endblock %}\n\nIf the payment was successful, you can retrieve the ``transaction_id`` in the\nsuccess view with the utility function, e.g.::\n\n def donate_success_detail(request):\n ...\n pledge_pk = touchnet.utils.get_transaction_id_from_request(request)\n ...\n\nProcess\n-------\n\n1. Create ``transaction_id`` by saving a model instance for the transaction \n (e.g. a pledge) or create a unique id\n2. Make ``RedirectForm`` with ``transaction_id`` and amount, and display\n3. Optionally, auto-submit ``RedirectForm`` with JavaScript\n4. User is redirected to Touchnet URL\n\nSuccess:\n\n5. User inputs credit card information\n6. Touchnet processes credit card\n7. Touchnet send POST request to ``/touchnet/postback/``\n8. Django Touchnet verifies validity and sends signal to ``payment_received``\n9. Receiver receives signal and updates payment amount (e.g. ``pledge.amount_paid``)\n10. Touchnet redirects user to success URL configured\n11. Display success and confirmation\n\nError:\n\n5. An error occurs\n6. Touchnet redirects user to error URL configured\n7. Display error\n\nCancel:\n\n5. User cancels\n6. Touchnet send POST request to ``/touchnet/postback/``\n7. Django Touchnet verifies validity and sends signal to ``payment_cancelled``\n8. Receiver receives signal and processes further (e.g. possibly delete order)\n9. Touchnet redirects user to cancel URL configured\n10. Display cancellation", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://creativemedia.ucdavis.edu/", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-touchnet", "package_url": "https://pypi.org/project/django-touchnet/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-touchnet/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://creativemedia.ucdavis.edu/" }, "release_url": "https://pypi.org/project/django-touchnet/0.2.2/", "requires_dist": null, "requires_python": null, "summary": "A Django app to integrate Touchnet.", "version": "0.2.2" }, "last_serial": 1553675, "releases": { "0.2.2": [ { "comment_text": "", "digests": { "md5": "f63f8003e2eb7dd8f0a6d04706e2ecb0", "sha256": "7ec40ec20cade6c99e6d28b5cc16e76dd619ad77ea7b96cf3e185dfe2bc655a7" }, "downloads": -1, "filename": "django-touchnet-0.2.2.tar.gz", "has_sig": false, "md5_digest": "f63f8003e2eb7dd8f0a6d04706e2ecb0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6690, "upload_time": "2015-05-19T20:56:20", "url": "https://files.pythonhosted.org/packages/bb/59/84472229e8b15f6bf1e40acd05991ad8e320f6c98c3c61b60a38aa1c6a84/django-touchnet-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f63f8003e2eb7dd8f0a6d04706e2ecb0", "sha256": "7ec40ec20cade6c99e6d28b5cc16e76dd619ad77ea7b96cf3e185dfe2bc655a7" }, "downloads": -1, "filename": "django-touchnet-0.2.2.tar.gz", "has_sig": false, "md5_digest": "f63f8003e2eb7dd8f0a6d04706e2ecb0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6690, "upload_time": "2015-05-19T20:56:20", "url": "https://files.pythonhosted.org/packages/bb/59/84472229e8b15f6bf1e40acd05991ad8e320f6c98c3c61b60a38aa1c6a84/django-touchnet-0.2.2.tar.gz" } ] }