{ "info": { "author": "GoPay", "author_email": "integrace@gopay.cz", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "GoPay's Python SDK for Payments REST API\n========================================\n\n|Build Status|\n\n\u00a0Requirements\n-------------\n\n- Python >= 2.6, Python 3\n\n\n\u00a0Installation\n-------------\n\nThe simplest way to install SDK is to use\n`PIP `__:\n\n.. code:: bash\n\n pip install gopay\n\nBasic usage\n-----------\n\n.. code:: python\n\n import gopay\n\n # minimal configuration\n payments = gopay.payments({\n 'goid': 'my goid',\n 'clientId': 'my id',\n 'clientSecret': 'my secret',\n 'isProductionMode': False\n })\n\n # full configuration\n payments = gopay.payments({\n 'goid': 'my goid',\n 'clientId': 'my id',\n 'clientSecret': 'my secret',\n 'isProductionMode': False,\n 'scope': gopay.TokenScope.ALL,\n 'language': gopay.Language.CZECH,\n 'timeout': 30\n })\n\nConfiguration\n~~~~~~~~~~~~~\n\nRequired fields\n^^^^^^^^^^^^^^^\n\n+------------------------+-------------+-----------------------------------------------------------------------------------+\n| Required field | Data type | Documentation |\n+========================+=============+===================================================================================+\n| ``goid`` | string | default GoPay account used in ``create_payment`` if ``target`` is not specified |\n+------------------------+-------------+-----------------------------------------------------------------------------------+\n| ``clientId`` | string | https://doc.gopay.com/en/?shell#oauth |\n+------------------------+-------------+-----------------------------------------------------------------------------------+\n| ``clientSecret`` | string | https://doc.gopay.com/en/?shell#oauth |\n+------------------------+-------------+-----------------------------------------------------------------------------------+\n| ``isProductionMode`` | boolean | `test or production environment? `__ |\n+------------------------+-------------+-----------------------------------------------------------------------------------+\n\nOptional fields\n^^^^^^^^^^^^^^^\n\n+------------------+-------------+----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+\n| Optional field | Data type | Default value | Documentation |\n+==================+=============+==========================================================+==========================================================================================================================================================+\n| ``scope`` | string | ```gopay.enums.TokenScope.ALL`` `__ | https://doc.gopay.com/en/?shell#scope |\n+------------------+-------------+----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+\n| ``language`` | string | ```gopay.enums.Language.ENGLISH`` `__ | language used in ``create_payment`` if ``lang`` is not specified + used for `localization of errors `__ |\n+------------------+-------------+----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+\n| ``timeout`` | int | 30 | Browser timeout in seconds |\n+------------------+-------------+----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+\n\n\u00a0Available methods\n~~~~~~~~~~~~~~~~~~\n\n+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------+\n| API | SDK method |\n+=========================================================================================================================+====================================================+\n| `Create standard payment `__ | ``payments.create_payment({})`` |\n+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------+\n| `Status of the payment `__ | ``payments.get_status(id_payment)`` |\n+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------+\n| `Refund of the payment `__ | ``payments.refund_payment(id_payment, $amount)`` |\n+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------+\n| `Create recurring payment `__ | ``payments.create_payment({})`` |\n+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------+\n| `Recurring payment on demand `__ | ``payments.create_recurrence(id_payment, {})`` |\n+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------+\n| `Cancellation of the recurring payment `__ | ``payments.void_recurrence(id_payment)`` |\n+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------+\n| `Create pre-authorized payment `__ | ``payments.create_payment({})`` |\n+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------+\n| `Charge of pre-authorized payment `__ | ``payments.capture_authorization(id_payment)`` |\n+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------+\n| `Cancellation of the pre-authorized payment `__ | ``payments.void_authorization(id_payment)`` |\n+-------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------+\n\nSDK response? Has my call succeed?\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n| SDK returns wrapped API response. Every method returns\n| ```gopay.http.response`` object `__. Structure of\n``json/__str__``\n| should be same as in `documentation `__.\n| SDK throws no exception. Please create an issue if you catch one.\n\n.. code:: python\n\n response = payments.create_payment({})\n if response.has_succeed():\n print(\"hooray, API returned \" + str(response))\n return response.json['gw_url'] # url for initiation of gateway\n else:\n # errors format: https://doc.gopay.com/en/?shell#http-result-codes\n print(\"oops, API returned \" + str(response.status_code) + \": \" + str(response))\n\n+------------------------------+----------------------------------------------------------------------------+\n| Method | Description |\n+==============================+============================================================================+\n| ``response.has_succeed()`` | checks if API returns status code *200* |\n+------------------------------+----------------------------------------------------------------------------+\n| ``response.json`` | decoded response, returned objects are converted into associative arrays |\n+------------------------------+----------------------------------------------------------------------------+\n| ``response.status_code`` | HTTP status code |\n+------------------------------+----------------------------------------------------------------------------+\n| ``response.__str__()`` | raw body from HTTP response |\n+------------------------------+----------------------------------------------------------------------------+\n\n\u00a0Are required fields and allowed values validated?\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n| **No.** API `validates\nfields `__ pretty\nextensively\n| so there is no need to duplicate validation in SDK. It would only\nintroduce new type of error.\n| Or we would have to perfectly simulate API error messages. That's why\nSDK just calls API which\n| behavior is well documented in\n`doc.gopay.com `__.\n\n--------------\n\nAdvanced usage\n--------------\n\nInitiation of the payment gateway\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n # create payment and pass url to template\n response = payments.create_payment({})\n if response.has_succeed():\n templateParameters = {\n 'gatewayUrl': response.json['gw_url'],\n 'embedJs': gopay.url_to_embedjs()\n }\n # render template\n\n`Inline gateway `__\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: jinja\n\n
\" method=\"post\" id=\"gopay-payment-button\">\n \n \n
\n\n`Redirect gateway `__\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: jinja\n\n
\" method=\"post\">\n \n
\n\n`Asynchronous initialization using JavaScript `__\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nEnums (`Code lists `__)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n| Instead of hardcoding bank codes string you can use predefined enums.\n| Check using enums in `create-payment\nexample `__\n\n+----------------------------------------+------------------------------------------------------------------------+\n| Type | Description |\n+========================================+========================================================================+\n| `Language `__ | Payment language, localization of error messages |\n+----------------------------------------+------------------------------------------------------------------------+\n| `Token scope `__ | Authorization scope for `OAuth2 `__ |\n+----------------------------------------+------------------------------------------------------------------------+\n| `Payment enums `__ | Enums for creating payment |\n+----------------------------------------+------------------------------------------------------------------------+\n| `Response enums `__ | Result of creating payment, executing payment operations |\n+----------------------------------------+------------------------------------------------------------------------+\n\nCache access token\n~~~~~~~~~~~~~~~~~~\n\n| Access token expires after 30 minutes so it's expensive to use new\ntoken for every request.\n| Unfortunately it's default behavior of\n```gopay.oauth2.InMemoryTokenCache`` `__.\n| But you can implement your cache and store tokens in Memcache, Redis,\nfiles, ... It's up to you.\n\n| Your cache must implement template methods ``get_token`` and\n``set_token``.\n| Be aware that there are two\n`scopes `__ (``TokenScope``) and\n| SDK can be used for different clients (``clientId``,\n``isProductionMode``). So ``client`` passed to\n| methods is unique identifier (``string``) that is built for current\nenvironment.\n| Below you can see example implementation of caching tokens in memory:\n\n.. code:: python\n\n # register cache in optional service configuration\n payments = gopay.payments(\n {}, # your config\n {'cache': MyCache()}\n )\n\n.. code:: python\n\n class MyCache:\n def __init__(self):\n self.tokens = {}\n\n def get_token(self, client):\n return self.tokens.get(client) # return None if token not exists\n\n def set_token(self, client, token):\n self.tokens[client] = token\n\nLog HTTP communication\n~~~~~~~~~~~~~~~~~~~~~~\n\n| You can log every request and response from communication with API.\nCheck available loggers below.\n| Or you can implement your own logger, just implement function that\ntakes two arguments:\n| ```gopay.http.request`` `__ and\n```gopay.http.response`` `__.\n\n.. code:: python\n\n # register logger in optional service configuration\n payments = gopay.payments(\n {}, # your config\n {'logger': my_logger}\n )\n\n def my_logger(request, response):\n print(vars(request))\n print(vars(response))\n\n+--------------------------------------------------------------+-------------------------------------------------------------------+\n| Available logger | Description |\n+==============================================================+===================================================================+\n| `gopay.http.null\\_logger `__ | Default logger which does nothing |\n+--------------------------------------------------------------+-------------------------------------------------------------------+\n| `tests.remote.debug\\_logger `__ | Prints request and response in `remote tests `__ |\n+--------------------------------------------------------------+-------------------------------------------------------------------+\n\nContributing\n------------\n\n| Contributions from others would be very much appreciated! Send\n| `pull\nrequest `__/\n| `issue `__.\nThanks!\n\nLicense\n-------\n\n| Copyright (c) 2015 GoPay.com. MIT Licensed,\n| see\n`LICENSE `__\nfor details.\n\n.. |Build Status| image:: https://travis-ci.org/gopaycommunity/gopay-python-api.svg?branch=master\n:target: https://travis-ci.org/gopaycommunity/gopay-python-api\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gopaycommunity/gopay-python-sdk", "keywords": "gopay payments sdk rest api", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "gopay", "package_url": "https://pypi.org/project/gopay/", "platform": "", "project_url": "https://pypi.org/project/gopay/", "project_urls": { "Homepage": "https://github.com/gopaycommunity/gopay-python-sdk" }, "release_url": "https://pypi.org/project/gopay/1.2.3/", "requires_dist": null, "requires_python": "", "summary": "GoPay's Python SDK for Payments REST API", "version": "1.2.3" }, "last_serial": 3524039, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "5e9de2c6f2913dd708de3512106b31e3", "sha256": "ba23544648ffc7e31917e5f3dbf040f3054846215f6e870789303443a884287e" }, "downloads": -1, "filename": "gopay-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5e9de2c6f2913dd708de3512106b31e3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12762, "upload_time": "2015-12-02T11:06:50", "url": "https://files.pythonhosted.org/packages/9f/71/50c963d0e2d8b305d9f17e36fb88d245b1f3e927d20d23f0fc3e46c161ca/gopay-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "235b34f7f506f7efd3d80497a3fe71ce", "sha256": "713e818e7e4c3204ae3a7c44aaf0c7c19cd7875103e84ce03c26bee23d657aa2" }, "downloads": -1, "filename": "gopay-1.0.0.tar.gz", "has_sig": false, "md5_digest": "235b34f7f506f7efd3d80497a3fe71ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9304, "upload_time": "2015-12-02T11:07:06", "url": "https://files.pythonhosted.org/packages/73/e7/05c424b8939149a89437dbdbd95c3202ca25c878d37dd33feb9335bcaca0/gopay-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "6abd4850c75dbac1cca2086d65e00c2b", "sha256": "10730a93d173b607ed32dd4d6796b85be95abee590574b1fb8667b51b00f4530" }, "downloads": -1, "filename": "gopay-1.1.0.tar.gz", "has_sig": false, "md5_digest": "6abd4850c75dbac1cca2086d65e00c2b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14827, "upload_time": "2017-05-10T12:39:30", "url": "https://files.pythonhosted.org/packages/61/f4/356a131273d8f4418dd61ea5b9275cba601bea832293a08ac5a666dfecde/gopay-1.1.0.tar.gz" } ], "1.2.0": [], "1.2.1": [ { "comment_text": "", "digests": { "md5": "a274756e4bfdcfe4290386f9b80c2a63", "sha256": "aff8dff52cd19ce8b319418fee17ae786bddd0244c5b8699b4f415425dd6112e" }, "downloads": -1, "filename": "gopay-1.2.1.tar.gz", "has_sig": false, "md5_digest": "a274756e4bfdcfe4290386f9b80c2a63", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15164, "upload_time": "2017-10-05T14:40:15", "url": "https://files.pythonhosted.org/packages/8f/bd/0a73d287edf4e6befb23c8b31858b79bf7a75ef207d80603612e98327848/gopay-1.2.1.tar.gz" } ], "1.2.3": [ { "comment_text": "", "digests": { "md5": "4981c526479f4dc2fac266a5e0db7ec0", "sha256": "9d618bf9b3b1c90faa3ce9b9cc0753bb6a03539855d05b1e624b6bde38a4efa3" }, "downloads": -1, "filename": "gopay-1.2.3.tar.gz", "has_sig": false, "md5_digest": "4981c526479f4dc2fac266a5e0db7ec0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14597, "upload_time": "2018-01-26T12:17:37", "url": "https://files.pythonhosted.org/packages/85/42/d90d0cc3236429117aa65f68aad698769cd6b6a51550d34bc7d7f051c668/gopay-1.2.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4981c526479f4dc2fac266a5e0db7ec0", "sha256": "9d618bf9b3b1c90faa3ce9b9cc0753bb6a03539855d05b1e624b6bde38a4efa3" }, "downloads": -1, "filename": "gopay-1.2.3.tar.gz", "has_sig": false, "md5_digest": "4981c526479f4dc2fac266a5e0db7ec0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14597, "upload_time": "2018-01-26T12:17:37", "url": "https://files.pythonhosted.org/packages/85/42/d90d0cc3236429117aa65f68aad698769cd6b6a51550d34bc7d7f051c668/gopay-1.2.3.tar.gz" } ] }