Metadata-Version: 2.1
Name: cloudtipsadp
Version: 0.5.0
Summary: CloudTips Adapter - integration module with API CloudPayments.
Project-URL: Homepage, https://github.com/SETTER2000/cloudtips-adp
Project-URL: Bug Tracker, https://github.com/SETTER2000/cloudtips-adp/issues
Author-email: setter <lphp@mail.ru>
License: MIT License
        
        Copyright (c) 2022 Alexander Petrov
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# cloudtips-adp
CloudTips Adapter позволяет интегрировать прием донатов в Django приложение.

## Старт
Установка
```angular2html
pip install cloudtipsadp
```
Удаление пакета
```angular2html
pip uninstall cloudtipsadp
```
Зависимости разрешить 
```angular2html
pip install python-dotenv requests
```
### Настройка переменных окружения
В корне проекта создать файл .env 

```angular2html
sudo touch .env
```
Для авторизации на CloudTips добавить настройки в файл .env

placeId - идентификатор вашего заведения (в админке CloudTips)

```angular2html
Grant_type=password
Client_id=Partner
UserName=<your_email>
Password=<your_password>

placeId=<your_placeId>
```

##  Работа с пакетом

```angular2html
from cloudtipsadp.clients import Connect, SandboxClient 
```
### Работа с тестовым сервисом
Установка соединения c песочницей (тестовый сервис CloudTips)
* Эта инструкция обязательна в любом файле где используется пакет
```angular2html
connect = Connect(SandboxClient())
```
### Работа с Production Serves
После тестирования для работы с production сервисом поменяйте данные в файле .
env, уберите SandboxClient из Connect.
```angular2html
connect = Connect()
```

### В общем установка зависимостей для модуля выглядит так
```angular2html
from cloudtipsadp.clients import Connect, SandboxClient
from cloudtipsadp import Cloudtipsadp

connect = Connect(SandboxClient())
cta = Cloudtipsadp()
```


## Получатель
#### Создать получателя донатов

```angular2html
response = cta.receivers_create(cta.receivers(name, phone_number))
```

#### Вариант просмотра результата ответа сервера
```angular2html
if response.get('succeed'):
    print(response.get('data'))
else:
    response.get('errors')
```


## Заведения
#### Информация по всем заведениям ТСП.
```angular2html
response = cta.places_get(cta.places())
```
#### Привязка получателя к заведению. Отправить сотруднику на его номер телефона код в смс сообщении.
```angular2html
response = cta.places_send(cta.places(user_id))
```
#### Подтверждение привязки телефона (пользователя) к предприятию. Передать код из смс.
```angular2html
response = cta.places_confirm(cta.places(user_id, confirm_code))
```



## Карты
#### Список карт получателя
```angular2html
response = cta.cards_get(cta.cards(user_id))
```
#### Отправить криптограмму
```angular2html
response = cta.cards_auth(cta.cards(user_id, checkout))
```

## Накопления
#### Получить общую сумму донатов, по сотруднику
```angular2html
response = cta.accums_get(cta.accums(user_id))
```