Skip to content

Commit

Permalink
Patch for CairoSVG issue from hoosnick/payme-pkg-3.0b
Browse files Browse the repository at this point in the history
  • Loading branch information
hoosnick authored Aug 22, 2023
2 parents e8e0c8a + 88430bf commit b372620
Show file tree
Hide file tree
Showing 42 changed files with 696 additions and 97 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Documentation

on:
push:
branches:
- payme-pkg-3.0b
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
- run: pip install -r requirements/docs-requirements.txt
- run: mkdocs gh-deploy --force
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
pip install pylint
- name: Analysing the code with pylint
run: |
pylint ./lib/*
pylint ./lib/*
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# virtual env
env/
venv/

# dev test
core/
my_app/
db.sqlite3
manage.py
dist/
venv/

# ide configs
.vscode/
.idea/

# caches
__pycache__/
paymentsuz.egg-info/
payme_pkg.egg-info/
manage.py
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[MASTER]
disable=no-member,
disable=no-member,invalid-name,
unnecessary-pass,
useless-option-value,
too-few-public-methods,
Expand Down
Binary file added docs/src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions docs/src/en/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: Introduction
---

# **Welcome!**

### Uzbekistan Payment Providers Packages

[<img align="right" alt="PayTechUz" height="280" width="280" src="https://github.com/PayTechUz/.github/assets/73847672/90e1c28a-f3ae-409a-8d8c-341b0fbe39e3" />](https://pay-tech.uz)

Welcome to the PayTechUz organization! This project aims to provide developers with seamless integration and implementation of Payment Providers APIs in Uzbekistan. Whether you're a Python enthusiast or a Go guru, we've got you covered with our versatile tech stack.

## Table of Contents

- [Introduction](#introduction)
- [Website](#website)
- [Telegram Group](#telegram-group)
- [Tech Stack](#tech-stack)
- [Usage](#usage)
- [Contributing](#contributing)
- [Support](#support)
- [License](#license)

## Introduction

Integrating payment providers into your applications is crucial in today's digital landscape. This project simplifies the process of integrating Payment Providers APIs in Uzbekistan, allowing you to focus on building amazing products while leaving the payment processing worries behind.

## Website

Visit our website [pay-tech.uz](https://pay-tech.uz) to explore detailed documentation, guides, and API references. We regularly update the documentation to ensure you have the most up-to-date information at your disposal.

## Telegram Group

Join our vibrant developer community on Telegram to connect with fellow developers, ask questions, share experiences, and stay updated with the latest news and announcements.

[Telegram Group](https://t.me/+krHlGUizJrI1Zjli)

## Tech Stack

We have carefully chosen the following tech stack to ensure flexibility and ease of use:

- [![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://python.org/)
- [![Go](https://img.shields.io/badge/Go-00ADD8?style=for-the-badge&logo=go&logoColor=white)](https://go.dev/)

The combination of Python and Go offers a wide range of possibilities to cater to the preferences of different developers.

## Usage

Our packages are designed to streamline the integration process. Follow the detailed instructions in the documentation for each package to integrate the desired Payment Providers API seamlessly.

## Contributing

We welcome contributions from the community to make this project even better. If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request. Please ensure you follow our [contribution guidelines](https://github.com/PayTechUz/.github/blob/main/profile/CONTRIBUTING.md).

## Support

If you encounter any problems, have questions, or need assistance with the integration, our team is here to help. Reach out to us on our [Telegram Group](https://t.me/+ydVV_9B3Xh02NGEy) or email us at [email protected].

## License

This project is licensed under the [MIT License](https://github.com/PayTechUz/.github/blob/main/profile/LICENSE.txt), making it open and free for everyone to use, modify, and distribute.

---

We hope our PayTechUz packages make your payment integration process a delightful experience. Happy coding!
6 changes: 6 additions & 0 deletions docs/src/en/merchant-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Merchant API methods
description: Merchant API methods
---

# Merchant API methods
6 changes: 6 additions & 0 deletions docs/src/en/sandbox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Sandbox (Testing)
description: Sandbox (Testing)
---

# Sandbox (Testing)
6 changes: 6 additions & 0 deletions docs/src/en/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Interaction setup
description: Interaction setup
---

# Interaction setup
6 changes: 6 additions & 0 deletions docs/src/en/subscribe-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Subscribe API methods
description: Subscribe API methods
---

# Subscribe API methods
6 changes: 6 additions & 0 deletions docs/src/en/support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Technical support
description: Technical support
---

# Technical support
23 changes: 23 additions & 0 deletions docs/src/overrides/partials/nav.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<nav
class="md-nav md-nav--primary"
aria-label="{{ lang.t('nav.title') }}"
data-md-level="0"
>
<label class="md-nav__title" for="__drawer">
<a
href="{{ config.site_url | default(nav.homepage.url, true) | url }}"
title="{{ config.site_name }}"
class="md-nav__button md-logo"
aria-label="{{ config.site_name }}"
>
{% include "partials/logo.html" %}
</a>
</label>
{% if config.repo_url %}
<div class="md-nav__source">{% include "partials/source.html" %}</div>
{% endif %}
<ul class="md-nav__list" data-md-scrollfix>
{% for nav_item in nav %} {% set path = "nav-" + loop.index | string %} {%
set level = 1 %} {% include "partials/nav-item.html" %} {% endfor %}
</ul>
</nav>
5 changes: 5 additions & 0 deletions docs/src/ru/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Введение
---

# **Добро пожаловать!**
6 changes: 6 additions & 0 deletions docs/src/ru/merchant-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Методы Merchant API
description: Методы Merchant API
---

# Методы Merchant API
6 changes: 6 additions & 0 deletions docs/src/ru/sandbox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Песочница (Тестирование)
description: Песочница (Тестирование)
---

# Песочница (Тестирование)
6 changes: 6 additions & 0 deletions docs/src/ru/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Настройка взаимодействия
description: Настройка взаимодействия
---

# Настройка взаимодействия
6 changes: 6 additions & 0 deletions docs/src/ru/subscribe-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Методы Subscribe API
description: Методы Subscribe API
---

# Методы Subscribe API
6 changes: 6 additions & 0 deletions docs/src/ru/support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Техническая поддержка
description: Техническая поддержка
---

# Техническая поддержка
5 changes: 5 additions & 0 deletions docs/src/uz/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Kirish
---

# **Xush kelibsiz!**
6 changes: 6 additions & 0 deletions docs/src/uz/merchant-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Merchant API metodlari
description: Merchant API metodlari
---

# Merchant API metodlari
6 changes: 6 additions & 0 deletions docs/src/uz/sandbox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Qumdon (Sandbox)
description: Qumdon (Sandbox)
---

# Qumdon (Sandbox)
6 changes: 6 additions & 0 deletions docs/src/uz/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Sozlash (Setup)
description: Sozlash (Setup)
---

# Sozlash (Setup)
6 changes: 6 additions & 0 deletions docs/src/uz/subscribe-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Subscribe API metodlari
description: Subscribe API metodlari
---

# Subscribe API metodlari
6 changes: 6 additions & 0 deletions docs/src/uz/support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Texnik yordam
description: Texnik yordam
---

# Texnik yordam
25 changes: 17 additions & 8 deletions lib/payme/admin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
from django.contrib import admin

from payme.models import CUSTOM_ORDER
from payme.models import Order as DefaultOrderModel
from payme.models import (
Item, MerchatTransactionsModel,
OrderDetail, ShippingDetail
)
# pylint: disable=fixme
# TODO: order Payme models in admin panel
# 1. OrderDetail
# 2. Item
# 3. ShippingDetail
# 4. MerchatTransactionsModel

from payme.models import MerchatTransactionsModel

if not CUSTOM_ORDER:
admin.site.register(DefaultOrderModel)

admin.site.register(MerchatTransactionsModel)
admin.site.register(
[
OrderDetail, Item,
ShippingDetail,
MerchatTransactionsModel,
]
)
7 changes: 7 additions & 0 deletions lib/payme/errors/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,10 @@ class PaymeTimeoutException(Exception):
"""
Payme timeout exception that means that payme is working slowly.
"""


class QRCodeError(Exception):
"""
QRCodeError Exception \
Raises when an error occurs while generating a QR code.
"""
13 changes: 7 additions & 6 deletions lib/payme/methods/cancel_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from django.db import transaction

from payme.utils.logging import logger
from payme.models import MerchatTransactionsModel
from payme.errors.exceptions import PerformTransactionDoesNotExist
from payme.models import MerchatTransactionsModel as MTM
from payme.serializers import MerchatTransactionsModelSerializer as MTMS
from payme.utils.logging import logger


class CancelTransaction:
Expand All @@ -25,16 +25,17 @@ def __call__(self, params: dict):
)
try:
with transaction.atomic():
transactions: MerchatTransactionsModel = \
MerchatTransactionsModel.objects.filter(
_id=clean_data.get('_id'),
).first()
transactions = MTM.objects.filter(
_id=clean_data.get('_id')
).first()

if transactions.cancel_time == 0:
transactions.cancel_time = int(time.time() * 1000)
if transactions.perform_time == 0:
transactions.state = -1
if transactions.perform_time != 0:
transactions.state = -2

transactions.reason = clean_data.get("reason")
transactions.save()

Expand Down
19 changes: 17 additions & 2 deletions lib/payme/methods/check_perform_transaction.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from payme.serializers import (
MerchatTransactionsModelSerializer,
OrderModelSerializer
)
from payme.utils.get_params import get_params
from payme.serializers import MerchatTransactionsModelSerializer
from payme.utils.order_finder import Order


class CheckPerformTransaction:
Expand All @@ -11,16 +15,27 @@ class CheckPerformTransaction:
-------------------------
https://developer.help.paycom.uz/metody-merchant-api/checktransaction
"""

def __call__(self, params: dict) -> dict:
serializer = MerchatTransactionsModelSerializer(
data=get_params(params)
)
serializer.is_valid(raise_exception=True)

order = OrderModelSerializer(
instance=Order.objects.get(
id=serializer.validated_data.get('order_id')
)
)

response = {
"result": {
"allow": True,
}
"detail": order.data.get("detail")
}
}

if not order.data.get("detail"):
del response["result"]["detail"]

return None, response
5 changes: 2 additions & 3 deletions lib/payme/methods/check_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ class CheckTransaction:
-------------------------
https://developer.help.paycom.uz/metody-merchant-api/checkperformtransaction
"""

def __call__(self, params: dict) -> None:
clean_data: dict = MTMS.get_validated_data(
params=params
)
clean_data: dict = MTMS.get_validated_data(params=params)

try:
transaction = \
Expand Down
Loading

0 comments on commit b372620

Please sign in to comment.