{ "info": { "author": "Andrei Onel", "author_email": "andrei@edumo.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Topic :: Office/Business :: Financial", "Topic :: Text Processing :: Markup :: XML" ], "description": "mobilPy\n=======\n\nmobilPy helps you with everything you need to implement\n`mobilPay `__'s online payment\nsolution. Steps: - create an account - get approved - create a merchant\n- download keys (private and public) - copy the signature (just a\nstring)\n\n*NOTE* You will have two private keys: for testing and production. The\npublic key is the same.\n\nInstall\n-------\n\nTo install the library, run:\n\n.. code:: sh\n\n pip install mobilpy\n\nUsage\n-----\n\n.. code:: python\n\n from mobilpy import Client\n\n # the signature for your account\n signature = 'DLAN-1R5V-19EN-XXXX-NFJA'\n # the path to the public key\n public_key = \"./sandbox.DLAN-1R5V-19EN-XXXX-NFJA.public.cer\"\n # the private_key\n private_key = \"./sandbox.DLAN-1R5V-19EN-XXXX-NFJA.private.key\"\n\n client = Client(signature=signature, public_key=public_key, private_key=private_key)\n\n # optional dict containing details about the customer\n # if they are sent, the customer will have a short checkout by skipping the second step in the payment flow\n billing_details = {\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"address\": \"\",\n \"phone\": \"\",\n \"email\": \"\"\n }\n # optional dict with details that you would need internally\n # these are returned when the webhook is called\n params = {\n \"subscription_id\": \"\",\n \"basket_id\": \"\",\n etc.\n }\n\n options = {\n \"order_id\": \"\" # int/string, max 64 length\n \"currency\": \"RON\", # string, RON or other\n \"amount\": 1, # float, between 0.10 and 99999\n \"customer_id\": \"\", # int/string\n \"details\": \"\", # string, description for this transaction\n \"billing\": billing_details, # dict, OPTIONAL\n \"params\": params, # dict, OPTIONAL,\n \n # the webhook where the response from mobilPay will be sent\n \"confirm_url\": \"\",\n # the url where the user will be redirected\n \"return_url\": \"\"\n }\n response = client.create_payment_data(**options)\n\nThe ``response`` is an dict that has two keys: ``env_key`` and ``data``.\nThese need to be used in the front end and make the request to mobilPay.\n\nFor example, the HTML might look like this:\n\n.. code:: html\n\n
\n \n \n \n \n
\n\nThe POST urls for the form are: - testing:\n``http://sandboxsecure.mobilpay.ro`` - production:\n``https://secure.mobilpay.ro``\n\nWebhook\n-------\n\nmobilPay will make a ``POST`` request to the url you set as\n``confirm_url``. mobilPy has methods to help you parse it and offer a\nresponse.\n\n.. code:: python\n\n post = # get the post data\n env_key = post.get('env_key')\n data = post.get('data')\n\n client = Client(signature=signature, public_key=public_key, private_key=private_key)\n\n request_xml = client.decrypt_message(env_key, data)\n request_object = client.parse_request_xml(request_xml)\n\n # do some magic\n\nIn order to check if the transaction was successful you need to check\n``error_code`` AND ``action``:\n\n.. code:: python\n\n transaction_successful = request_object.get('error_code') == '0' and request_object.get('action') == 'confirmed'\n if transaction_successful:\n # everything is ok\n\nCreating a response\n-------------------\n\nYou need to let mobilPay know if everything is ok on your end or if\nsomething weird happened. If everything is ok you can create a response\nlike this:\n\n.. code:: python\n\n message = \"All good captain\"\n response_xml = client.create_reponse(message=message)\n\nIf you had an error:\n\n.. code:: python\n\n # message that will help you debug. it will appear in your dashboard\n message = \"Everything is on fire\"\n # this can be \"1\" (temporary error) or \"2\" (permanent error)\n error_type = \"1\"\n # your internal error code. a number maybe. OPTIONAL\n error_code = ''\n response_xml = client.create_reponse(message=message, error_type=error_type, error_code=error_code)\n\nThe response doesn't need to be encrypted. Just respond with the xml.\n\nCrediting\n---------\n\nIf a transaction was credited from the Dashboard, mobilPay will make a\nnew webhook ``POST``. You can check for that:\n\n.. code:: python\n\n # if the transaction was credited from mobilpay\n if request_object.get('action') == 'credit':\n # do something\n # return a reponse\n\nTODO\n====\n\nSome things that still need to be done: \n- tests \n- too many dependencies: pyopenssl and pycrypto \n- migrate to pycryptodome (pycrypto is not maintained) \n- add support for: instalements, recurrence\n- maybe add prefilled credit card data payments?\n\n\nDisclaimer\n----------\nThis library is not associated in any way with mobilPay\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/onel/mobilpy", "keywords": "online payments mobilpay netopia", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "mobilpy", "package_url": "https://pypi.org/project/mobilpy/", "platform": "", "project_url": "https://pypi.org/project/mobilpy/", "project_urls": { "Homepage": "https://github.com/onel/mobilpy" }, "release_url": "https://pypi.org/project/mobilpy/0.3/", "requires_dist": null, "requires_python": "", "summary": "Library that helps create the XML necessary for online payments with MobilPay", "version": "0.3" }, "last_serial": 4718422, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "99c641bd270b29e306fcf8dfad23135c", "sha256": "0adc6e7d58d131fb0c65ff1da14e16049643d01c15e7ebec236a12279b55e0ec" }, "downloads": -1, "filename": "mobilpy-0.1.tar.gz", "has_sig": false, "md5_digest": "99c641bd270b29e306fcf8dfad23135c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3947, "upload_time": "2019-01-06T16:51:07", "url": "https://files.pythonhosted.org/packages/bb/2b/1e7c86429de5a32b95aeee27174ce6aa21b026f0a23ece10396e9f441124/mobilpy-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "66d072f2dc4da2ec5583fab263bc8c3c", "sha256": "913fd01747bb2f7fd8e567e2dfe736a5cfd500ddc535a454469116d1bca90445" }, "downloads": -1, "filename": "mobilpy-0.2.tar.gz", "has_sig": false, "md5_digest": "66d072f2dc4da2ec5583fab263bc8c3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6163, "upload_time": "2019-01-06T19:16:34", "url": "https://files.pythonhosted.org/packages/c0/9b/e7837bb7ea5dac015de1cc2e59fadd0b264c92de5c7c3bb796b5feb07c7f/mobilpy-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "a05966cae630dd00b57724f6e216b093", "sha256": "6bb0f48cc0b2caffce969118a9212818c6d1bc9903f8cc6e9925b122d2ddefcb" }, "downloads": -1, "filename": "mobilpy-0.3.tar.gz", "has_sig": false, "md5_digest": "a05966cae630dd00b57724f6e216b093", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6212, "upload_time": "2019-01-20T14:48:46", "url": "https://files.pythonhosted.org/packages/4c/1d/3a5cb669ff80ad4b06403e6c39c5b6a5d29eafaa9aa5e7e4ecd47a5b14f6/mobilpy-0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a05966cae630dd00b57724f6e216b093", "sha256": "6bb0f48cc0b2caffce969118a9212818c6d1bc9903f8cc6e9925b122d2ddefcb" }, "downloads": -1, "filename": "mobilpy-0.3.tar.gz", "has_sig": false, "md5_digest": "a05966cae630dd00b57724f6e216b093", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6212, "upload_time": "2019-01-20T14:48:46", "url": "https://files.pythonhosted.org/packages/4c/1d/3a5cb669ff80ad4b06403e6c39c5b6a5d29eafaa9aa5e7e4ecd47a5b14f6/mobilpy-0.3.tar.gz" } ] }