Skip to content

Commit

Permalink
Merge pull request #82 from PayTechUz/feat/nakapitel
Browse files Browse the repository at this point in the history
Feat/nakapitel
  • Loading branch information
Muhammadali-Akbarov authored Nov 1, 2024
2 parents 41b0a01 + dfaee10 commit da88a47
Show file tree
Hide file tree
Showing 69 changed files with 2,325 additions and 3,293 deletions.
3 changes: 0 additions & 3 deletions .env.example

This file was deleted.

2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 120
26 changes: 0 additions & 26 deletions .github/workflows/pylint.yml

This file was deleted.

7 changes: 3 additions & 4 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ jobs:
python-version: ["3.11"]

env:
PAYCOM_BASE_URL: ${{ secrets.PAYCOM_BASE_URL }}
PAYCOM_ID: ${{ secrets.PAYCOM_ID }}
PAYCOM_KEY: ${{ secrets.PAYCOM_KEY }}
PAYME_ID: ${{ secrets.PAYME_ID }}
PAYME_KEY: ${{ secrets.PAYME_KEY }}

steps:
- uses: actions/checkout@v2
Expand All @@ -34,4 +33,4 @@ jobs:
- name: Run unit tests
run: |
python payme_test.py
python tests.py
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ paymentsuz.egg-info/
payme_pkg.egg-info/

.DS_Store
build/
build/
migrations/
10 changes: 4 additions & 6 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[MASTER]
disable=no-member,
unnecessary-pass,
useless-option-value,
too-few-public-methods,
missing-module-docstring,
missing-function-docstring
disable=W0613,E1101,W0718,W0223,W0621,W1203,W0622,C0116,E0213, C0114

ignore-long-lines = True
max-line-length = 120
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ 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.
OTHER DEALINGS IN THE SOFTWARE.
127 changes: 115 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,125 @@
# Payme Uzbekistan Integration Uzcard and Humo
<h1 align="center">Payme PKG</h1>


<p align="center">
<a href="https://youtu.be/r2RO3kJVP7g">
<img style="width: 60%;" src="https://i.postimg.cc/WbD32bHC/payme-pkg-demo-m4a.gif">
</a>
<a href="https://docs.pay-tech.uz"><img src="https://img.shields.io/static/v1?message=Documented%20on%20GitBook&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=3F89A1"></a>
<a href="https://github.com/PayTechUz/payme-pkg"><img src="https://img.shields.io/badge/Open_Source-❤️-FDA599?"/></a>
<a href="t.me/+DK7n7lKx8GY5ZDZi"><img src="https://img.shields.io/badge/Community-Join%20Us-blueviolet"/></a>
<a href="https://github.com/PayTechUz/payme-pkg/issues"><img src="https://img.shields.io/github/issues/gitbookIO/gitbook"/></a>
</p>
Support Group - <a href="https://t.me/+Ng1axYLNyBAyYTRi">Telegram</a> <br/>
YouTube - <a href="https://youtu.be/sJORIyykHcw">Watch Video</a><br/>
Implementation Sample - https://github.com/PayTechUz/payme-sample

<p align="center">Welcome to payme-pkg, the open source payme sdk for python.</p>

<p align="center">You can use for test and production mode. Join our community and ask everything you need.
</p>
<a href="https://docs.pay-tech.uz">
<p align="center">Visit to full documentation for Merchant and Subcribe Api</p>
</a>
<p align="center">
<br>
<a href="https://www.buymeacoffee.com/paytechuz" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
<img style="width: 60%;" src="https://i.postimg.cc/WbD32bHC/payme-pkg-demo-m4a.gif">
</p>

## Installation

```shell
pip install payme-pkg
```

## Installation to Django

Add `'payme'` in to your settings.py

```python
INSTALLED_APPS = [
...
'payme',
...
]
```

Add `'payme'` credentials inside to settings.py

One time payment configuration settings.py
```python
PAYME_ID = "your-payme-id"
PAYME_KEY = "your-payme-key"
PAYME_ACCOUNT_FIELD = "id"
PAYME_AMOUNT_FIELD = "total_amount"
PAYME_ACCOUNT_MODEL = "orders.models.Orders"
PAYME_ONE_TIME_PAYMENT = True
```

Multi payment configuration settings.py
```python
PAYME_ID = "your-payme-id"
PAYME_KEY = "your-payme-key"
PAYME_ACCOUNT_FIELD = "id"
PAYME_ACCOUNT_MODEL = "clients.models.Client"
PAYME_ONE_TIME_PAYMENT = False
```

Create a new View that about handling call backs
```python
from payme.views import PaymeWebHookAPIView


class PaymeCallBackAPIView(PaymeWebHookAPIView):
def handle_created_payment(self, params, result, *args, **kwargs):
"""
Handle the successful payment. You can override this method
"""
print(f"Transaction created for this params: {params} and cr_result: {result}")

def handle_successfully_payment(self, params, result, *args, **kwargs):
"""
Handle the successful payment. You can override this method
"""
print(f"Transaction successfully performed for this params: {params} and performed_result: {result}")

def handle_cancelled_payment(self, params, result, *args, **kwargs):
"""
Handle the cancelled payment. You can override this method
"""
print(f"Transaction cancelled for this params: {params} and cancelled_result: {result}")
```

Add a `payme` path to core of urlpatterns:

```python
from django.urls import path
from django.urls import include

from your_app.views import PaymeCallBackAPIView

urlpatterns = [
...
path("payment/update/", PaymeCallBackAPIView.as_view()),
...
]
```

Run migrations
```shell
python3 manage.py makemigrations && python manage.py migrate
```
🎉 Congratulations you have been integrated merchant api methods with django, keep reading docs. After successfull migrations check your admin panel and see results what happened.

## Generate Pay Link

Example to generate link:

- Input

```python
from payme import Payme

## 📚 **Full Documentation:**
payme = Payme(payme_id="your-payme-id")
pay_link = payme.initializer.generate_pay_link(id=123456, amount=5000, return_url="https://example.com")
print(pay_link)
```

For in-depth details, examples, and comprehensive documentation, please visit our official documentation website: [Documentation Website](https://docs.pay-tech.uz).
- Output

Happy coding! 🚀
```
https://checkout.paycom.uz/bT15b3VyLXBheW1lLWlkO2FjLmlkPTEyMzQ1NjthPTUwMDAwMDtjPWh0dHBzOi8vZXhhbXBsZS5jb20=
```
Loading

0 comments on commit da88a47

Please sign in to comment.