{ "info": { "author": "Daniel Garcia (cr0hn)", "author_email": "", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Other Audience", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 3" ], "description": "WooCommerce Subscription Checker\n================================\n\n+----------------+-----------------------------------------------------------------+\n|Current version | 1.0 |\n+----------------+-----------------------------------------------------------------+\n|Project site | https://github.com/cr0hn/woocommerce-subscription-check |\n+----------------+-----------------------------------------------------------------+\n|Issues | https://github.com/cr0hn/woocommerce-subscription-check/issues/ |\n+----------------+-----------------------------------------------------------------+\n|Python versions | 3.6 or above |\n+----------------+-----------------------------------------------------------------+\n\n\nMotivations\n===========\n\nWoocommerce doesn't allow to check the user subscriptions (or any other data) from the Wordpress API without being an admin user.\n\nThis means that if a regular user want to check their subscriptions, products or something else, it need to be an admin role. And, in non-secure scenarios, this is not good idea, i.e: in the browser through Javascript\n\nWhat that project does?\n=======================\n\nThis project exposes non-privileged API and allow to regular users to check their subscription, without the need to have an admin role.\n\nRequirements\n============\n\nYou must install in your Wordpress the plugins:\n\n- JWT Authentication for WP-API\n- WP REST API\n- Disable REST API and Require JWT (Recommendable)\n\n**IMPORTANT**\n\nBe careful with JWT plugin. Ensure you follow these steps, in the same order:\n\n1 - Add to wp-config.php\n------------------------\n\nAdd these lines in your wp-config.php:\n\ndefine('JWT_AUTH_SECRET_KEY', 'your-top-secrect-key');\ndefine('JWT_AUTH_CORS_ENABLE', true);\n\n**IT'S MORE IMPORTANT** to add these lines just before the definition of AUTH_KEY, SECURE_AUTH_KEY... (https://github.com/Tmeister/wp-api-jwt-auth/issues/59)\n\n2 - Activate the plugin\n-----------------------\n\nAfter you add the data from step 1, then activate the plugin.\n\nEnvironment vars\n================\n\n- LISTEN_ADDR (default: 127.0.0.1)\n- LISTEN_PORT (default: 9000)\n- API_PREFIX (default: v1)\n- LOG_LEVEL (default: 1)\n- SENTRY_DSN (default: None)\n- REDIS_HOST (default: 127.0.0.1)\n- REDIS_PORT (default: 6379)\n- REDIS_DB (default: 1)\n- SCHEME (default: https)\n- DOMAIN: **Mandatory**\n- ADMIN_ROLE_USER: **Mandatory**\n- ADMIN_ROLE_PASSWORD: **Mandatory**\n\n\nUsing Docker\n============\n\n.. code-block:: bash\n\n > docker run -p 9000:9000 --rm cr0hn/woocommerce-subscription-check\n\nUsing Pypi\n==========\n\n.. code-block:: bash\n\n > python3.6 -m pip install woocommerce_subscriptions_check\n\nInstalling with Sentry support:\n\n\n.. code-block:: bash\n\n > python3.6 -m pip install woocommerce_subscriptions_check[sentry]\n\n\nEnd-points\n==========\n\n/api/v1/login\n--------------\n\n**General**\n\n- Method: POST\n- Input data as JSON\n- Input value: user / password\n\n**Example request**\n\n.. code-block:: bash\n\n > curl -v -X POST http://127.0.0.1:9000/api/v1/login -d '{\"user\": \"MyUser\", \"password\": \"MyPassword\"}'\n\n**Example responses**\n\n*Authentication done*\n\n- HTTP STATUS: 200\n- Response:\n\n.. code-block:: json\n\n {\"token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI19s82.eyJpc3MiOiJodHRwczpcL1wvd2hvaXNsZWF2aW5nLmNvbSIsImlhdCI6MTUyMzQ0ODQxMSwibmJmIjoxNTIzNDQ4NDExLCJleHAiOjE1MjQwNTMyMTEsImRhdGEiOnsidXNlciI6eyJpZCI6IjIifX19.bu8ChmreEqDt5wwACSB5L_-8V9hHPRzJI-zGHB1Unv4\"}\n\n\n*Authentication fails*\n\n- HTTP STATUS: 403\n- Response:\n\n.. code-block:: json\n\n {\"message\":\"Invalid user or password\"}\n\n*Invalid Data*\n\n- HTTP STATUS: 400\n- Response: \"Invalid JSON\"\n\n/api/v1/subscriptions\n---------------------\n\n**General**\n\n- Method: GET\n- Input value: user / password\n\n**Example request**\n\n.. code-block:: bash\n\n > curl -v -X POST http://127.0.0.1:9000/api/v1/subscriptions -H 'Authorization: Bearer TOKEN_FROM_LOGIN'\n\n**Example responses**\n\n*user has subscriptions*\n\n- HTTP STATUS: 200\n- Response:\n\n.. code-block:: json\n\n {\n \"subscriptionName\": \"micro\",\n \"subscriptionStatus\": \"active\",\n \"expireDate\": \"2018-05-10T16:17:31\"\n }\n\n*user has NOT subscriptions*\n\n- HTTP STATUS: 200\n- Response:\n\n.. code-block:: json\n\n {\n \"subscriptionName\": null,\n \"subscriptionStatus\": null,\n \"expireDate\": null\n }\n\n*Authentication fails*\n\n- HTTP STATUS: 403\n- Response:\n\n.. code-block:: json\n\n {\"message\":\"Invalid token. You must authenticate first\"}\n\n*Invalid Data*\n\n- HTTP STATUS: 400\n- Response: \"Invalid JSON\"", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cr0hn/woocommerce-subscriptions-check", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "woocommerce-subscriptions-check", "package_url": "https://pypi.org/project/woocommerce-subscriptions-check/", "platform": "", "project_url": "https://pypi.org/project/woocommerce-subscriptions-check/", "project_urls": { "Homepage": "https://github.com/cr0hn/woocommerce-subscriptions-check" }, "release_url": "https://pypi.org/project/woocommerce-subscriptions-check/1.0.6/", "requires_dist": null, "requires_python": "", "summary": "Check user subscriptions in Woocommerce without have and admin role", "version": "1.0.6" }, "last_serial": 3830593, "releases": { "1.0.4": [ { "comment_text": "", "digests": { "md5": "3d20e9069ea3a7b034123c1063a8e6b2", "sha256": "4e2bf0f7e31be7f508d6ef9237018d3025299768c16fd7cc4d6b00e9ff70da34" }, "downloads": -1, "filename": "woocommerce_subscriptions_check-1.0.4.tar.gz", "has_sig": false, "md5_digest": "3d20e9069ea3a7b034123c1063a8e6b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8642, "upload_time": "2018-05-03T11:19:57", "url": "https://files.pythonhosted.org/packages/37/fe/e288b91ac3db46af48ac8f8001f4e6441e9f5a6393193ebd0cfabad7d1cd/woocommerce_subscriptions_check-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "81291ddeaf57fe1ecf68374518966572", "sha256": "bf097db5752e7aa688a336b11e2982ec896b0ecdbb2fcf1d66f03f0bceee7a56" }, "downloads": -1, "filename": "woocommerce_subscriptions_check-1.0.5.tar.gz", "has_sig": false, "md5_digest": "81291ddeaf57fe1ecf68374518966572", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10240, "upload_time": "2018-05-03T11:22:22", "url": "https://files.pythonhosted.org/packages/c1/fa/f6549395bdc2d1f1f769dcb9a7c440921a0345837999a8f8c760275f41b9/woocommerce_subscriptions_check-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "f7b9c33f450cf9f9d2659d6099382015", "sha256": "428f66a0d2b0c3d79d951061f319d70981ab20e446ffb487a414bd07ea76135d" }, "downloads": -1, "filename": "woocommerce_subscriptions_check-1.0.6.tar.gz", "has_sig": false, "md5_digest": "f7b9c33f450cf9f9d2659d6099382015", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8654, "upload_time": "2018-05-03T11:26:03", "url": "https://files.pythonhosted.org/packages/56/45/781c44cf98a6f14751ee4f4a1b31595e9838e245c43cb4684f2c31bbc9b4/woocommerce_subscriptions_check-1.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f7b9c33f450cf9f9d2659d6099382015", "sha256": "428f66a0d2b0c3d79d951061f319d70981ab20e446ffb487a414bd07ea76135d" }, "downloads": -1, "filename": "woocommerce_subscriptions_check-1.0.6.tar.gz", "has_sig": false, "md5_digest": "f7b9c33f450cf9f9d2659d6099382015", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8654, "upload_time": "2018-05-03T11:26:03", "url": "https://files.pythonhosted.org/packages/56/45/781c44cf98a6f14751ee4f4a1b31595e9838e245c43cb4684f2c31bbc9b4/woocommerce_subscriptions_check-1.0.6.tar.gz" } ] }