Metadata-Version: 2.1
Name: ludialudom
Version: 0.5.3
Summary: Python API client for LudiaLudom
Home-page: https://gitlab.backbone.sk/darujme/ludialudom-python
Author: Jakub Dubec
Author-email: jakub.dubec@backbone.sk
License: proprietary
Keywords: ludialudom,requests,client,api
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/markdown
Requires-Dist: requests (>=2.21.0)

# LudiaLudom API Client for Python

[![pipeline status](https://dev01.backbone.sk/darujme/ludialudom-python/badges/master/pipeline.svg)](https://dev01.backbone.sk/darujme/ludialudom-python/commits/master)
[![coverage report](https://dev01.backbone.sk/darujme/ludialudom-python/badges/master/coverage.svg)](https://dev01.backbone.sk/darujme/ludialudom-python/commits/master)

Simple API client based on [requests](https://requests.readthedocs.io/en/master/) library aimed for communication
with LudiaLudom (LULU) service. Documentation for API is in [LudiaLudom API.docx](docs/LudiaLudom API.docx).

## Installation

```bash
# Pip
pip install --extra-index-url https://pypi.backbone.sk ludialudom

# easy_install
easy_install -i https://pypi.backbone.sk/simple/ ludialudom

# Manual
python setup.py install
```

### Pipenv

Add backbone source to the top of yours `Pipfile`:

```toml
[[source]]
name = "backbone"
url = "https://{USER}:{PASSWORD}@pypi.backbone.sk/simple"
verify_ssl = true
```

Now you are able to install the package: `pipenv install ludialudom`

## Usage

```python
import ludialudom
import decimal
from datetime import datetime

configuration = ludialudom.Configuration(
	ludialudom.Environment.Sandbox, 'bHVkaWFsdWRvbTpEZXY0UGVvcGxl', 'Pj3$*4QkF{q7-c6BR8_b5%eE&K2fCw?9r/8WY7a!3+Xi}p4HG2=ym&N96d-MxS5!'
)
client = ludialudom.LudiaLudom(configuration)

# Activate a project with id 42
client.project.activate(42)

# Deactivate a project with id 42
client.project.deactivate(42)

# Is the project with id 42 active?
client.project.is_active(42)

# Create payment URL (which is suppose to be passed to user to redirect)
payment_url = client.payment.create_payment_url(
	payment_id=1234, # Unique numeric payment identificator
	project_code=42, # Project ID in LULU
	channel=3, # LULU payment method ID
	amount=decimal.Decimal(50), # Donation value
	name="Arthur", # Given name of donor
	surname="Dent", # Surname of donor
	email="arthur.dent@gmail.com", # E-mail of donor
	start_date=datetime.fromisoformat('2019-01-01'), # Start of periodic payment period (if periodic)
	end_date=datetime.fromisoformat('2020-10-01'), # End of periodic payment period (optional)
	is_mobile=True, # Optimize payment page for mobile devices (optional)
)

# Change amount of periodic payment id 1234
client.payment.change_amount(1234, decimal.Decimal(40))

# Change state of payment id 1234
client.payment.change_state(1234, client.payment.PaymentState.SUSPENDED)

# Get state of payment id 1234
state = client.payment.get_state(1234) # PaymentState
```

## Development

Deploy to backbone PyPi server executing `./publish.sh`

## TODO

- Create Enum object for LULU payment methods

# CHANGELOG

## 0.5.3 : 22.05.2020

- **Fix**: `TransactionItem.Status.PENDING` introduced

## 0.5.2 : 24.04.2020

- **Fix**: `TransactionItem.Status.IN_PROGRESS` introduced

## 0.5.1 : 24.04.2020

- **Fix**: Fixed `TransactionItem.Status` annotation

## 0.5.0 : 24.04.2020

- **Change**: `TransactionItem.status` is now represented as enum `TransactionItem.Status`
- **Change**: Switched from pipenv to poetry

## 0.4.4. : 12.02.2020

- **Change**: Dataclasses are frozen

## 0.4.3 : 12.02.2020

- **Fix**: Strip string before checking emptiness of dataclass properties

## 0.4.2 : 12.02.2020

- **Change**: If `id_platba_widget_ext` is empty, set `TransactionItem` as `None`

## 0.4.1 : 04.02.2020

- **Feature**: Payment reports are downloaded if `Configuration.download_path` is specified
- **Change**: Renamed properties in `Payment.TransactionItem` and `Payment.SlipItem`
- **Note**: CI/CD configuration & code-style changes according to flake8

## 0.4.0 : 03.02.2020

- **Feature**: `GetRecipientPayments` endpoint implemented as `Payment.slips()`
- **Change**: `GetPaymnets` endpoint is renamed to function `Payment.transactions()`
- **Change**: Transaction endpoints returns dataclasses
- **Feature**: `getListOfExpire` endpoint implemented as `Card.expirations()`

## 0.3.1 : 31.01.2020

- **Fix**: Fixed CSV delimiter in `Payment.list()`
- **Note**: Basic test for `Payment.list()`
- **Note**: Pytest init

## 0.3.0 : 30.01.2020

- **Feature**: List payments
- **Change**: Introduced `parse` attribute in `request` method

## 0.2.0 : 10.01.2020

- **Change**: Package name is now just `ludialudom`

## 0.1.3 : 10.01.2020

- **Fix**: Fixed `setup.py` packages

## 0.1.2 : 19.12.2019

- **Fix**: Fixed URLs for sandbox and production

## 0.1.1 : 12.12.2019

- **Change**: Environment keep separated `api_url` and `web_url`
- **Change**: More fancy imports
- **Change**: Environments moved to `__init__.py`
- **Fix**: Signature has to be uppercase
- **Fix**: UUID JSON parsing fixed
- **Fix**: Valid payment url

## 0.1.0 : 06.12.2019

- Initial version


