{ "info": { "author": "Alan Justino da Silva", "author_email": "alan.justino@yahoo.com.br", "bugtrack_url": null, "classifiers": [ "Framework :: Django", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "Operating System :: OS Independent", "Topic :: Software Development" ], "description": "Django MoIP\n===========\n\nCAUTION: ITS STILL BEING IMPLEMENTED. READ THE FOLLOW AS A BIG TODO-LIST!\nFOR NOW, NO TEST WILL PASS\n\nAbout\n-----\n\nDjango MoIP is a pluggable application that implements MoIP using HTML and API integrations.\nIt is based on the [django-paypal](https://github.com/dcramer/django-paypal) work\nfrom John Boxall, David Cramer and Michael Thornhill (thank you!)\n\n\nUsing MoIP with the HTML integration + NIT\n------------------------------------------\n\nMoIP have an IPN (Instant Payment Notification), but it is called \"NIT\", from\nPortuguese \"Notifica\u00e7\u00e3o Instant\u00e2nea de Transa\u00e7\u00e3o\"\n\n1. Download the code from GitHub:\n\n git clone git://github.com/alanjds/django-moip.git\n\n1. Edit `settings.py` and add `django_moip.html.nit` to your `INSTALLED_APPS` \n and `MOIP_RECEIVER_EMAIL`:\n\n # settings.py\n ...\n INSTALLED_APPS = (... 'django_moip.integrations.html.nit', ...)\n ...\n MOIP_RECEIVER_EMAIL = \"yourmoipemail@example.com.br\"\n\n1. Create an instance of the `MoipPaymentForm` in the view where you would \n like to collect money. Call `render` on the instance in your template to \n write out the HTML.\n\n # views.py\n ...\n from django.conf import settings\n from django_moip.html.forms import MoipPaymentForm\n \n def view_that_asks_for_money(request):\n \n # What you want the button to do.\n moip_dict = {\n \"id_carteira\": settings.MOIP_RECEIVER_EMAIL,\n \"valor\": \"%.0f\" % (100 * 1234.0), # expects 2 decimal, no dot\n \"nome\": \"name of the item\",\n \"id_transacao\": \"unique-invoice-id\",\n }\n \n # Create the instance.\n form = MoipPaymentForm(initial=moip_dict)\n context = {\"form\": form}\n return render_to_response(\"payment.html\", context)\n \n \n \n ...\n

Show me the money!

\n \n {{ form.render }}\n\n Note that MoIP HTML integration have no way to specify where to send the\n client after made the payment, so you need to manually set this\n http://www.example.com/your-return-location/ at MoIP admin dashboard,\n for example. (Shame...)\n\n1. When someone uses this form to buy something, MoIP makes a HTTP POST to\n your \"notify_url\". MoIP calls this \"Notifica\u00e7\u00e3o Instant\u00e2nea de Transa\u00e7\u00e3o\" (NIT). \n The view `django_moip.html.nit.views.nit` handles NIT processing. To set the \n correct `notify_url` add the following to your `urls.py`:\n\n # urls.py\n ...\n urlpatterns = patterns('',\n (r'^something/hard/to/guess/', include('django_moip.html.nit.urls')),\n )\n\n1. Whenever an NIT is processed a signal will be sent with the result of the \n transaction. Connect the signals to actions to perform the needed operations\n when a successful payment is recieved.\n \n There are two signals for basic transactions:\n - `payment_was_successful` \n - `payment_was_flagged`\n\n MoIP is right now (2013.07) stabilizing its subscriptions and recurring\n payments. In the future, the following signals could be expected to exist:\n\n Four signals for subscriptions:\n - `subscription_cancel` - Sent when a subscription is cancelled.\n - `subscription_eot` - Sent when a subscription expires.\n - `subscription_modify` - Sent when a subscription is modified.\n - `subscription_signup` - Sent when a subscription is created.\n\n Several more for recurring payments:\n - `recurring_create` - Sent when a recurring payment is created.\n - `recurring_payment` - Sent when a payment is received from a recurring payment.\n - `recurring_cancel` - Sent when a recurring payment is cancelled.\n - `recurring_suspend` - Sent when a recurring payment is suspended.\n - `recurring_reactivate` - Sent when a recurring payment is reactivated.\n\n Connect to these signals and update your data accordingly. [Django Signals Documentation](http://docs.djangoproject.com/en/dev/topics/signals/).\n\n # models.py\n ...\n from django_moip.html.nit.signals import payment_was_successful\n \n def show_me_the_money(sender, **kwargs):\n nit_obj = sender\n # Undertake some action depending upon `nit_obj`.\n if nit_obj.custom == \"Upgrade all users!\":\n Users.objects.update(paid=True)\n payment_was_successful.connect(show_me_the_money)\n \n \nHaving the client back on your site\n-----------------------------------\n\nAs MoIP have no equivalent of Paypal's PDT, you need to set an static URL that\nyour client will be redirected back in case of successfull payment, or if he\nintentionaly desist after being denied.\n\nYou need to set this \"return url\" manually on MoIP admin dashboard. (Shame again)\n\nTo work around, django-moip allows you to set an session attribute\n`moip_go_after_return_url`, and the provided 'return_redirector' will redirect\nthe visitor having this attribute set.\n\n1. Download the code from GitHub:\n\n git clone git://github.com/alanjds/django-moip.git\n\n1. Edit `settings.py` and add `django_moip.html.redirector` to your `INSTALLED_APPS`.\n Just bewere that MoIP have no such thing as an \"identity token\", so you cannot\n rely on the call to say that the payment was successful.\n \n Bottomline: PLEASE, SET THE NIT AND BE SURE\n\n # settings.py\n ...\n INSTALLED_APPS = (... 'django_moip.html.redirector', ...)\n\n1. Create a view that uses `MoipPaymentForm` just like in MoIP NIT section.\n\n1. After someone uses this form to buy something, MoIP will return the user to your site at\n your \"return_url\" set on MoIP admin dashboard.\n The view `django_moip.html.redirector.views.return_redirector` handles the\n `moip_go_after_return_url` attribute on the visitor session. Please specify\n the correct `moip_go_after_return_url` on the session BEFORE showing the\n form to MoIP payment, and add the following to your `urls.py`:\n\n # urls.py\n ...\n urlpatterns = patterns('',\n (r'^moip/redirector/', include('django_moip.html.redirector.urls')),\n ...\n )\n\n\nUsing MoIP with the API integration\n-----------------------------------\n\nMoIP is, right now (2013.07), the only widespread national payment gateway that\nprovides serverside API payments, in the style of PayPal Pro API (WPP).\n\nBUT they manually authorize every single account for this feature, and I am\ntrying to get this from some time, with no answer from its office. So,\nno feature until I have a way to test it. Bad bad MoIP: no cookie for you!.\n\nLinks:\n------\n\n1. [Set your NIT Endpoint and \"return url\" on MoIP admin dashboard](https://www.moip.com.br/AdmCheckout.do?method=optional)\n\n3. [MoIP HTML Integration Reference](https://www.moip.com.br/AdmCheckout.do?method=manual)\n\n\nLicense (MIT)\n=============\n\nCopyright (c) 2013 Alan Justino da Silva\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/alanjds/django-moip/tarball/0.1.1", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/alanjds/django-moip", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-moip", "package_url": "https://pypi.org/project/django-moip/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-moip/", "project_urls": { "Download": "https://github.com/alanjds/django-moip/tarball/0.1.1", "Homepage": "http://github.com/alanjds/django-moip" }, "release_url": "https://pypi.org/project/django-moip/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "A pluggable Django application for integrating MoIP HTML (for now)", "version": "0.1.1" }, "last_serial": 824617, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "de85a92d26b661591b29abe15041cb22", "sha256": "381b2ea62528851c0628e0f543b07b80f250d0f805251d50c3f831289da69cd9" }, "downloads": -1, "filename": "django-moip-0.1.1.tar.gz", "has_sig": false, "md5_digest": "de85a92d26b661591b29abe15041cb22", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16443, "upload_time": "2013-07-25T05:36:35", "url": "https://files.pythonhosted.org/packages/be/61/4765e302ec24f0f7ebd330cb615564bbfcc00a4c0bea98edf2976cf587ec/django-moip-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "de85a92d26b661591b29abe15041cb22", "sha256": "381b2ea62528851c0628e0f543b07b80f250d0f805251d50c3f831289da69cd9" }, "downloads": -1, "filename": "django-moip-0.1.1.tar.gz", "has_sig": false, "md5_digest": "de85a92d26b661591b29abe15041cb22", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16443, "upload_time": "2013-07-25T05:36:35", "url": "https://files.pythonhosted.org/packages/be/61/4765e302ec24f0f7ebd330cb615564bbfcc00a4c0bea98edf2976cf587ec/django-moip-0.1.1.tar.gz" } ] }