Skip to content

Commit

Permalink
πŸ”€ Merge pull request #71 from TimNekk/develop
Browse files Browse the repository at this point in the history
✨ Add Aaio Provider
  • Loading branch information
TimNekk authored Sep 13, 2024
2 parents ad0167f + c24b6ad commit cbd0abb
Show file tree
Hide file tree
Showing 35 changed files with 1,165 additions and 868 deletions.
11 changes: 0 additions & 11 deletions .deepsource.toml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: ⬆
reviewers:
- "TimNekk"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
versioning-strategy: "increase-if-necessary"
commit-message:
prefix: ⬆
reviewers:
- "TimNekk"
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lint

on:
- push
- pull_request

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Give execute permission to lint.sh
run: chmod +x ./scripts/lint.sh
- name: Lint code
run: ./scripts/lint.sh
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish to PyPI

on:
release:
types: [ published ]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: poetry install
- name: Build package
run: poetry build
- name: Publish to PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish
39 changes: 0 additions & 39 deletions .github/workflows/python-publish.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/tests.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Editor directories
.idea/
.vscode/

Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
Expand Down
File renamed without changes.
149 changes: 69 additions & 80 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,108 +1,97 @@
<h1 align="center">
<br>
<img src="logo.png" alt="PyPayment" height="300"></a>
<br>
PyPayment
<br>
</h1>

<h4 align="center">Payment providers API wrapper</h4>

<p class="badges" align="center">
<img src="https://img.shields.io/pypi/v/pypayment?color=orange" alt="PyPI">
<img src="https://img.shields.io/pypi/pyversions/pypayment?color=blueviolet" alt="Python 3">
<img src="https://github.com/TimNekk/pypayment/actions/workflows/tests.yml/badge.svg" alt="Tests">
<a href="https://deepsource.io/gh/TimNekk/pypayment/?ref=repository-badge}" target="_blank"><img alt="DeepSource" title="DeepSource" src="https://deepsource.io/gh/TimNekk/pypayment.svg/?label=active+issues&show_trend=true&token=YlQEv_BbbqmICG5Xy3skch_c"/></a>
</p>

<p align="center">
<a href="https://pypayment.readthedocs.io">Documentation</a> β€’
<a href="#providers">Providers</a> β€’
<a href="#installation">Installation</a> β€’
<a href="#quickstart">Quickstart</a> β€’
<a href="#contributing">Contributing</a> β€’
<a href="#license">License</a>
</p>

**PyPayment** is a Python wrapper for API of different payment providers.
It is designed to be a simple and easy to use library for developers to integrate payment into their applications.

Main idea is to provide a unified interface for different payment providers.

For more details see [documentation](https://pypayment.readthedocs.io).

## Providers:
<div align="center">
<h1>
<img src="assets/logo.png" alt="PyPayment" height="300">
<br>
<code>PyPayment</code>
</h1>
<div>
<a href="https://pypi.org/project/pypayment/"><img
alt="PyPI"
src="https://img.shields.io/pypi/v/pypayment?color=orange&style=flat-square"
></a>
<a href="https://www.python.org/"><img
alt="Python 3"
src="https://img.shields.io/pypi/pyversions/pypayment?color=blueviolet&style=flat-square"
></a>
<a href="https://github.com/TimNekk/PyPayment/blob/main/.github/workflows/lint.yml"><img
alt="Lint"
src="https://img.shields.io/github/actions/workflow/status/TimNekk/PyPayment/lint.yml?label=Lint&style=flat-square"
></a>
<a href="https://github.com/astral-sh/ruff"><img
alt="Ruff"
src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=flat-square"
></a>
<a href="https://gitmoji.dev"><img
alt="Gitmoji"
src="https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=flat-square"
></a>
</div>
</div>


**PyPayment** is a wrapper for payment provider APIs

> Main idea – **unified interface** for every provider
This library simplifies payment integration

### Supported Providers

- [Qiwi P2P](https://p2p.qiwi.com/)
- [YooMoney](https://yoomoney.ru/)
- [PayOk](https://payok.io/)
- [BetaTransfer](https://betatransfer.io/)
- [Aaio](https://aaio.so/)
- [Lava](https://lava.kz/) *(under development)*
## Installation

Install the current version with [PyPI](https://pypi.org/project/pypayment/)
## πŸ“¦ Installation

Install the latest version with [PyPI](https://pypi.org/project/pypayment/)

```bash
pip install -U pypayment
```

## Quickstart

Choose payment provider and authorize. For example, for Qiwi

```python
from pypayment import QiwiPayment

QiwiPayment.authorize("my_secret_key")
```

Create a payment and get it's `url`

```python
from pypayment import Payment, QiwiPayment

payment: Payment = QiwiPayment(amount=100) # E.x. commission is 10%

print(payment.url) # https://oplata.qiwi.com/form/?invoice_uid=payment_unique_id
```

Wait for payment to be completed and get it's income

Use `update()` method to update payment's `status` and `income`

```python
from pypayment import PaymentStatus

while payment.status != PaymentStatus.PAID:
input("Press Enter to update payment status and income")
payment.update()

print("Payment is completed!")
print(payment.income) # 90.0
```

Summary
## πŸš€ Quickstart

```python
# Choose payment provider. For example, Qiwi
from pypayment import Payment, QiwiPayment, PaymentStatus

# Authorize payment provider
QiwiPayment.authorize("my_secret_key")

payment: Payment = QiwiPayment(amount=100) # E.x. commission is 10%
print(payment.url) # https://oplata.qiwi.com/form/?invoice_uid=payment_unique_id
# Create a payment and get its url
payment: Payment = QiwiPayment(amount=100)
print(payment.url) # https://oplata.qiwi.com/form/?invoice_uid=<payment_unique_id>

# Wait for payment to be completed
while payment.status != PaymentStatus.PAID:
input("Press Enter to update payment status")
input("Press Enter to update payment status...")

# Use `update()` method to update payment's `status` and `income`
payment.update()

print("Payment is completed!")
print(payment.income) # 90.0
print(payment.income) # 90.0 (if commission is 10%)
```

## Contributing
> [!NOTE]
> For more details see [documentation](https://pypayment.readthedocs.io)
## πŸ‘₯ Contributing

Bug reports and/or pull requests are welcome
**Contributions are welcome! Here's how you can help:**

1. Fork it
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create a new Pull Request
6. Get your code reviewed
7. Merge your code
8. Get a 🌟

## License
## πŸ“ License

The module is available as open source under the terms of the [Apache License, Version 2.0](https://opensource.org/licenses/Apache-2.0)
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
File renamed without changes
14 changes: 7 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'pypayment'
copyright = '2023, TimNekk'
author = 'TimNekk'
master_doc = 'index'
project = "pypayment"
copyright = "2023, TimNekk"
author = "TimNekk"
master_doc = "index"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = []

templates_path = ['_templates']
templates_path = ["_templates"]
exclude_patterns = []

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
Loading

0 comments on commit cbd0abb

Please sign in to comment.