django-tegro-money


Namedjango-tegro-money JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/KotelnikovKP/django-tegro-money
SummaryDjango Tegro.Money HTTP API Connector
upload_time2023-06-20 10:35:13
maintainer
docs_urlNone
authorKonstantin Kotelnikov
requires_python>=3.8
licenseMIT License
keywords tegro money api connector
VCS
bugtrack_url
requirements requests django
Travis-CI
coveralls test coverage No coveralls.
            # Django Tegro Money

[![Build Status](https://img.shields.io/pypi/pyversions/django-tegro-money)](https://www.python.org/downloads/)
[![Build Status](https://img.shields.io/pypi/v/django-tegro-money)](https://pypi.org/project/django-tegro-money/)

Django API connector for [Tegro Money's HTTP APIs](https://tegro.money/docs/).

## Table of Contents

- [About](#about)
- [Development](#development)
- [Installation](#installation)
- [Usage](#usage)

## About
Put simply, `django-tegro-money` is the lightweight one-stop-shop module for the [Tegro Money's HTTP APIs](https://tegro.money/docs/).

It was designed with the following vision in mind:

> I wanted to build my own Django-dedicated connector to Tegro Money the system for accepting online payments with very little external resources. The goal of the connector is to provide entrepreneurs and developers with an easy-to-use high-performing module that has an active issue and discussion board leading to consistent improvements.

## Development
`Tegro Money` is being actively developed, and new API changes should arrive on `Tegro Money` very quickly. `Tegro Money` uses `requests` for its methods, alongside other built-in modules. Anyone is welcome to branch/fork the repository and add their own upgrades. If you think you've made substantial improvements to the module, submit a pull request, so we'll gladly take a look.

## Installation
`django-tegro-money` requires Django 3.2 or higher and Python 3.8 or higher.

The module can be installed manually or via [PyPI](https://pypi.org/project/pybit/) with `pip`:
```
pip install django-tegro-money
```
Add `django-tegro-money` to the `INSTALLED_APPS` in your `settings.py`:
```python
INSTALLED_APPS = [
    ...,
    'django_tegro_money',
    ...,
]
```
Add an entry to your `urls.py`:
```python
urlpatterns += [
    path('', include('django_tegro_money.urls')),
]
```
Run migration:
```
python manage.py migrate
```

## Usage
The first before using `django-tegro-money` you must register with `Tegro Money`. [Do it ...](https://tegro.money/my/register/).

Then you must add a store. [Do it ...](https://tegro.money/my/add-shop/).

You can find more information [here](https://tegro.money/docs/en/begin/register/).

NOTICE! Specify `/payment_status/` as `Notification URL`:
```
Notification URL
URL: https://<your_site>/payment_status/
```

Add secret parameters of your store (`Shop ID`, `Secret KEY` and `API KEY`) in your `settings.py` (it's best to store secret settings locally):

```python
TEGRO_MONEY_SHOP_ID = <Shop ID>
TEGRO_MONEY_SECRET_KEY = <Secret KEY>
TEGRO_MONEY_API_KEY = <API KEY>
```
Create `TegroMoney` object:
```python
tegro_money = TegroMoney(log_requests=True, timeout=10, max_retries=3, retry_delay=3)
```
Just use `TegroMoney` methods:
```python
# Create order and get payment

# Get data (you can get data from your form)
data = {
  "amount": 1200,
  "currency": "RUB",
  "order_id": "test order",
  "payment_system": 5,
  "fields": {
    "email": "user@email.ru",
    "phone": "79111231212"
  },
  "receipt": {
    "items": [
      {
        "name": "test item 1",
        "count": 1,
        "price": 600
      },
      {
        "name": "test item 2",
        "count": 1,
        "price": 600
      }
    ]
  }
}

# Send request to Tegro Money
try:
    result = tegro_money.create_order(**data)
    
    # Save order id from tegro money for future use
    tegro_money_order_id = result['data']['id']
    
    # Redirect to payment page
    return redirect(result['data']['url'])
except:
    pass
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/KotelnikovKP/django-tegro-money",
    "name": "django-tegro-money",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "tegro money api connector",
    "author": "Konstantin Kotelnikov",
    "author_email": "kotelnikov1302@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e2/ee/983f7d845b27c6f68df2db48d883a0b5ddc71dd7d5d73dc53315e526bd54/django-tegro-money-0.1.0.tar.gz",
    "platform": null,
    "description": "# Django Tegro Money\r\n\r\n[![Build Status](https://img.shields.io/pypi/pyversions/django-tegro-money)](https://www.python.org/downloads/)\r\n[![Build Status](https://img.shields.io/pypi/v/django-tegro-money)](https://pypi.org/project/django-tegro-money/)\r\n\r\nDjango API connector for [Tegro Money's HTTP APIs](https://tegro.money/docs/).\r\n\r\n## Table of Contents\r\n\r\n- [About](#about)\r\n- [Development](#development)\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n\r\n## About\r\nPut simply, `django-tegro-money` is the lightweight one-stop-shop module for the [Tegro Money's HTTP APIs](https://tegro.money/docs/).\r\n\r\nIt was designed with the following vision in mind:\r\n\r\n> I wanted to build my own Django-dedicated connector to Tegro Money the system for accepting online payments with very little external resources. The goal of the connector is to provide entrepreneurs and developers with an easy-to-use high-performing module that has an active issue and discussion board leading to consistent improvements.\r\n\r\n## Development\r\n`Tegro Money` is being actively developed, and new API changes should arrive on `Tegro Money` very quickly. `Tegro Money` uses `requests` for its methods, alongside other built-in modules. Anyone is welcome to branch/fork the repository and add their own upgrades. If you think you've made substantial improvements to the module, submit a pull request, so we'll gladly take a look.\r\n\r\n## Installation\r\n`django-tegro-money` requires Django 3.2 or higher and Python 3.8 or higher.\r\n\r\nThe module can be installed manually or via [PyPI](https://pypi.org/project/pybit/) with `pip`:\r\n```\r\npip install django-tegro-money\r\n```\r\nAdd `django-tegro-money` to the `INSTALLED_APPS` in your `settings.py`:\r\n```python\r\nINSTALLED_APPS = [\r\n    ...,\r\n    'django_tegro_money',\r\n    ...,\r\n]\r\n```\r\nAdd an entry to your `urls.py`:\r\n```python\r\nurlpatterns += [\r\n    path('', include('django_tegro_money.urls')),\r\n]\r\n```\r\nRun migration:\r\n```\r\npython manage.py migrate\r\n```\r\n\r\n## Usage\r\nThe first before using `django-tegro-money` you must register with `Tegro Money`. [Do it ...](https://tegro.money/my/register/).\r\n\r\nThen you must add a store. [Do it ...](https://tegro.money/my/add-shop/).\r\n\r\nYou can find more information [here](https://tegro.money/docs/en/begin/register/).\r\n\r\nNOTICE! Specify `/payment_status/` as `Notification URL`:\r\n```\r\nNotification URL\r\nURL: https://<your_site>/payment_status/\r\n```\r\n\r\nAdd secret parameters of your store (`Shop ID`, `Secret KEY` and `API KEY`) in your `settings.py` (it's best to store secret settings locally):\r\n\r\n```python\r\nTEGRO_MONEY_SHOP_ID = <Shop ID>\r\nTEGRO_MONEY_SECRET_KEY = <Secret KEY>\r\nTEGRO_MONEY_API_KEY = <API KEY>\r\n```\r\nCreate `TegroMoney` object:\r\n```python\r\ntegro_money = TegroMoney(log_requests=True, timeout=10, max_retries=3, retry_delay=3)\r\n```\r\nJust use `TegroMoney` methods:\r\n```python\r\n# Create order and get payment\r\n\r\n# Get data (you can get data from your form)\r\ndata = {\r\n  \"amount\": 1200,\r\n  \"currency\": \"RUB\",\r\n  \"order_id\": \"test order\",\r\n  \"payment_system\": 5,\r\n  \"fields\": {\r\n    \"email\": \"user@email.ru\",\r\n    \"phone\": \"79111231212\"\r\n  },\r\n  \"receipt\": {\r\n    \"items\": [\r\n      {\r\n        \"name\": \"test item 1\",\r\n        \"count\": 1,\r\n        \"price\": 600\r\n      },\r\n      {\r\n        \"name\": \"test item 2\",\r\n        \"count\": 1,\r\n        \"price\": 600\r\n      }\r\n    ]\r\n  }\r\n}\r\n\r\n# Send request to Tegro Money\r\ntry:\r\n    result = tegro_money.create_order(**data)\r\n    \r\n    # Save order id from tegro money for future use\r\n    tegro_money_order_id = result['data']['id']\r\n    \r\n    # Redirect to payment page\r\n    return redirect(result['data']['url'])\r\nexcept:\r\n    pass\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Django Tegro.Money HTTP API Connector",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/KotelnikovKP/django-tegro-money"
    },
    "split_keywords": [
        "tegro",
        "money",
        "api",
        "connector"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e2ee983f7d845b27c6f68df2db48d883a0b5ddc71dd7d5d73dc53315e526bd54",
                "md5": "a1b734b94dd852ee17da1c15f96421b8",
                "sha256": "06fe88a71b759ddd8463d53807ba588a3e0102e0181d605c4bd2f84031d94aa2"
            },
            "downloads": -1,
            "filename": "django-tegro-money-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a1b734b94dd852ee17da1c15f96421b8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 13250,
            "upload_time": "2023-06-20T10:35:13",
            "upload_time_iso_8601": "2023-06-20T10:35:13.411903Z",
            "url": "https://files.pythonhosted.org/packages/e2/ee/983f7d845b27c6f68df2db48d883a0b5ddc71dd7d5d73dc53315e526bd54/django-tegro-money-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-20 10:35:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "KotelnikovKP",
    "github_project": "django-tegro-money",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.22.0"
                ]
            ]
        },
        {
            "name": "django",
            "specs": [
                [
                    ">=",
                    "3.2"
                ]
            ]
        }
    ],
    "lcname": "django-tegro-money"
}
        
Elapsed time: 0.10080s