{
"info": {
"author": "101Loop",
"author_email": "pypidev@civilmachines.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 1.11",
"Framework :: Django :: 2.0",
"Framework :: Django :: 2.1",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Internet :: WWW/HTTP"
],
"description": "# Instamojo | Django REST Framework\n\n**A package for Instamojo integration in Django REST Framework**
\n\n`Instamojo | Django REST Framework` is a Django packaged app that provides necessary `views` based in Django REST \nFramework. It enables easy integration of Instamojo Payment Gateway with Web/Mobile Application with a RESTful API \nbased server.\n\nContributors: **WE'RE LOOKING FOR SOMEONE WHO CAN CONTRIBUTE IN DOCS**\n- **[Civil Machines Technologies Private Limited](https://github.com/civilmahines)**: For providing me platform and\nfunds for research work. This project is hosted currently with `CMT` only. \n- **[Himanshu Shankar](https://github.com/iamhssingh)**: Himanshu Shankar has initiated this project and worked on this\nproject to collect useful functions and classes that are being used in various projects.\n\n#### Installation\n\n- Download and Install via `pip`\n```\npip install drf_instamojo\n```\nor
\nDownload and Install via `easy_install`\n```\neasy_install drf_instamojo\n```\n- Add, if wanted, `drfaddons` in `INSTALLED_APPS` (This is although not required!)\n```\nINSTALLED_APPS = [\n ...\n 'drf_instamojo',\n ...\n]\n```\n- Also add other dependencies in `INSTALLED_APPS`
\n```\nINSTALLED_APPS = [\n ...\n 'drfaddons',\n ...\n]\n```\n- Include urls of `drf_instamojo` in `urls.py`\n```\nurlpatterns = [\n ...\n path('api/instamojo/', include('drf_instamojo.urls')),\n ...\n]\n\n# or\n\nurlpatterns = [\n ...\n url(r'^api/instamojo/', include('drf_instamojo.urls')),\n ...\n]\n```\n- Run migrate command:\n```\npython manage.py migrate\n```\n\n### MODELS\nThe application has three models:\n\n- `InstamojoConfiguration`: You need to define your Instamojo configurations in this model. Only one object can have\n`is_active` set to `True` which will be used with Instamojo API.\n- `PaymentRequest`: This will contain all the Instamojo Payment Request that one will create with Instamojo.\n- `Payment`: This will contain all the responses received from Instamojo API against payment.\n\n### VIEWS\nThe application has following views:\n\n- `ListAddPaymentRequestView`: All payment request should be made on this view. Requires a logged in user.\nIt'll provide user with required data, including `longurl` that will be used to make payment.\n- `ListAddPaymentView`: All response data should be posted on this view. Doesn't requires a logged in user.\n\n### URLS\n- `request/`: All payment request to be made via this URL.\n- `payment/`: All payment reponses to be posted on this URL.\n\n### Quickstart Guide\n\n- Complete `Installation Steps` (mentioned above)\n- Create a configuration via `Django Admin` in `Instamojo Configuration`\n- Set `is_active` to `True`\n- Note: Use sandbox mode credential at first\n\n### How to integrate with apps\n\n- Use `serializers` to integrate with custom apps.\n\n#### Creating Payment Request\n##### Example\n- Create a view: `PaymentView`\n- Use `PaymentRequestSerializer` to create a payment request.\n- Check example code in `serializers.py`:\n```\n# Initialize serializer with proper data\nprs = PaymentRequestSerializer(data={'amount': 120.00, 'purpose': 'Test', 'send_sms': False,\n 'redirect_url': 'http://127.0.0.1/api/test/'})\n\n# Check if data is valid\nprs.is_valid(raise_exception=True)\n\ninstance = prs.save(created_by=user)\n```\n- Save `instance` as foreign key in app pointing to bill for which the payment request is made.\n- Return `longurl` to client for making payment\n\n##### Problem with created_by requirement in .save() of serializer\n- If app doesn't require user to login, use following logic: \n - Inside payment view, take following data from user:\n - Name of the customer\n - Mobile Number of the customer `mobile: 9987987345`\n - Email of the customer `email: test@abc.com`\n - Use following code to create a logic around getting an existing or creating a new user:\n```\nfrom django.contrib.auth import get_user_model\n\nuser_model = get_user_model()\ntry:\n user = user_model.objects.get(email=email)\nexcept user_model.DoesNotExist:\n try:\n user = user_model.objects.get(mobile=mobile)\n except user_model.DoesNotExist:\n # Now you're dead sure that user does not exists.\n user = user_model.objects.create(name=name, mobile=mobile, email=email, password=\"RANDOM_PASSWORD\")\n\n```\n- Otherwise, simply use `user = request.user` as user while calling `.save()` on serializer.\n- *Bonus Pointer*: Check out **[Django REST Framework - User](https://github.com/101loop/drf-user/)**\n\n#### Payment Completion\n- Use `payment_done` signal\n- Create `signals` python directory with `__init__.py, handlers.py` in app\n- In `handlers.py`, create a function for handling `payment_done` signal\n```\nfrom django.dispatch import receiver\n\nfrom drf_instamojo.models import PaymentRequest\nfrom drf_instamojo.signals import payment_done\n\n\n@receiver(signal=payment_done, sender=PaymentRequest)\ndef payment_done_handler(instance: PaymentRequest, sender, *args, **kwargs):\n ...\n # Payment completed\n # bill.paid()\n # item.dispatch()\n ...\n```\n\n\n",
"description_content_type": "text/markdown",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/101Loop/drf-instamojo",
"keywords": "",
"license": "GPLv3",
"maintainer": "",
"maintainer_email": "",
"name": "drf-instamojo",
"package_url": "https://pypi.org/project/drf-instamojo/",
"platform": "",
"project_url": "https://pypi.org/project/drf-instamojo/",
"project_urls": {
"Homepage": "https://github.com/101Loop/drf-instamojo"
},
"release_url": "https://pypi.org/project/drf-instamojo/0.0.1/",
"requires_dist": [
"Django (>=1.11)",
"djangorestframework (>=3.8.0)",
"drfaddons (>=0.1.0)",
"instamojo-wrapper (==1.1)"
],
"requires_python": ">=3.4",
"summary": "Instamojo Integration based on Django REST Framework",
"version": "0.0.1"
},
"last_serial": 4602556,
"releases": {
"0.0.1": [
{
"comment_text": "",
"digests": {
"md5": "e0452395e6bf0e28efdbb407eb6a11f3",
"sha256": "f246f4ea50cddbc060b7c3433496dd01d49d145cb7142868f15bf6d8ab462249"
},
"downloads": -1,
"filename": "drf_instamojo-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e0452395e6bf0e28efdbb407eb6a11f3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.4",
"size": 27436,
"upload_time": "2018-12-15T13:14:40",
"url": "https://files.pythonhosted.org/packages/ea/53/604812dd8e031c9b5810bfe8c839d88459d4a296a89e543ac2257ac121da/drf_instamojo-0.0.1-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "2382a8af8d64c64fdc62a0cdbea2a25c",
"sha256": "9a50f683e69a98527ab09c650c3dd10c9a92e2e134d96d5573fc530577df5681"
},
"downloads": -1,
"filename": "drf_instamojo-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "2382a8af8d64c64fdc62a0cdbea2a25c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.4",
"size": 13519,
"upload_time": "2018-12-15T13:14:43",
"url": "https://files.pythonhosted.org/packages/bb/5b/ccd54e15a95367026880e368fa41d642e9b27d0a94ebe330e09e51702995/drf_instamojo-0.0.1.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "e0452395e6bf0e28efdbb407eb6a11f3",
"sha256": "f246f4ea50cddbc060b7c3433496dd01d49d145cb7142868f15bf6d8ab462249"
},
"downloads": -1,
"filename": "drf_instamojo-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e0452395e6bf0e28efdbb407eb6a11f3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.4",
"size": 27436,
"upload_time": "2018-12-15T13:14:40",
"url": "https://files.pythonhosted.org/packages/ea/53/604812dd8e031c9b5810bfe8c839d88459d4a296a89e543ac2257ac121da/drf_instamojo-0.0.1-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "2382a8af8d64c64fdc62a0cdbea2a25c",
"sha256": "9a50f683e69a98527ab09c650c3dd10c9a92e2e134d96d5573fc530577df5681"
},
"downloads": -1,
"filename": "drf_instamojo-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "2382a8af8d64c64fdc62a0cdbea2a25c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.4",
"size": 13519,
"upload_time": "2018-12-15T13:14:43",
"url": "https://files.pythonhosted.org/packages/bb/5b/ccd54e15a95367026880e368fa41d642e9b27d0a94ebe330e09e51702995/drf_instamojo-0.0.1.tar.gz"
}
]
}