Skip to content

Commit

Permalink
Merge pull request #15 from mmzeynalli/feature/v2
Browse files Browse the repository at this point in the history
New Structure
  • Loading branch information
mmzeynalli authored Oct 28, 2024
2 parents 8c72520 + 0440a47 commit 31a94df
Show file tree
Hide file tree
Showing 48 changed files with 2,033 additions and 1,220 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ on:
push:
branches:
- main
paths:
- '**.py'
pull_request:
types:
- opened
- synchronize
paths:
- '**.py'
schedule:
# cron every week on monday
- cron: "0 0 * * 1"
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,6 @@ cython_debug/
#.idea/

# User Defined
test.py
test.py
*.lcov
site
31 changes: 16 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
hooks:
- id: mypy
additional_dependencies:
- pydantic
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.4
hooks:
# Run the formatter.
- id: ruff-format
# Run the linter.
- id: ruff
args: [--fix]
- repo: local
hooks:
- id: format
name: format
entry: make format
types: [python]
language: system
- id: lint
name: lint
entry: make lint
types: [python]
language: system
pass_filenames: false
- id: typecheck
name: typecheck
entry: make type-check
types: [python]
language: system
- id: secure
name: secure
entry: make secure
Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
## v2.0.0

[GitHub release](https://github.com/mmzeynalli/integrify/releases/tag/v2.0.0)

### What's Changed

#### Fixes

* Changed the whole structure and released a new version with better handling of requests and responses.

## v1.0.3 (2024-10-07)

[GitHub release](https://github.com/mmzeynalli/integrify/releases/tag/v1.0.3)

### What's Changed

#### Fixes

* Replaced `StrEnum` with `str, Enum` to be python <3.11 friendly.

## v1.0.1 (2024-09-08)

### What's Changed

#### Fixes

* Updated version for PyPI

## v1.0.0 (2024-09-27)

### What's Changed

#### New integrations

* Added EPoint intergration
* Added EPoint documentation
24 changes: 24 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: Integrify
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Miradil
family-names: Zeynalli
email: [email protected]
- given-names: Vahid
family-names: Hasanzada
email: [email protected]
repository-code: 'https://github.com/mmzeynalli/integrify'
url: 'https://integrify.mmzeynalli.dev/'
abstract: >-
Integrify is a request library that eases the API
integrations.
keywords:
- integrify
license: GPL-3.0-or-later
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Proyektə öz tövhənizi qatmaq üçün, zəhmət olmazsa, [bu dokumentasiyanı](http://integrify.mmzeynalli.dev/resources/contributing/) oxuyun.
123 changes: 108 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,118 @@
ifdef OS
PYTHON ?= .venv/Scripts/python.exe
TYPE_CHECK_COMMAND ?= echo Pytype package doesn't support Windows OS
else
PYTHON ?= .venv/bin/python
TYPE_CHECK_COMMAND ?= ${PYTHON} -m pytype --config=pytype.cfg src
endif
.PHONY: .poetry ## Check that Poetry is installed
.poetry:
@poetry -V || echo 'Please install Poetry: https://python-poetry.org/docs/#installation'

SETTINGS_FILENAME = pyproject.toml
.PHONY: .pre-commit ## Check that pre-commit is installed
.pre-commit:
@pre-commit -V || echo 'Please install pre-commit: https://pre-commit.com/'

.PHONY: install
install:
.PHONY: install ## Install the package, dependencies, and pre-commit for local development
install: .poetry
poetry install --no-interaction

.PHONY: install-main
install-main:
install-main: .poetry
poetry install --no-interaction --only main

.PHONY: refresh-lockfiles ## Sync lockfiles with requirements files.
refresh-lockfiles: .poetry
poetry lock --no-update

.PHONY: rebuild-lockfiles ## Rebuild lockfiles from scratch, updating all dependencies
rebuild-lockfiles: .poetry
poetry lock

.PHONY: format ## Auto-format python source files
format: .poetry
poetry run ruff check --fix
poetry run ruff format

.PHONY: lint ## Lint python source files
lint: .poetry
poetry run ruff check
poetry run ruff format --check

.PHONY: type-check ## Type-check python source files
type-check: .poetry
poetry run mypy .

.PHONY: test ## Run all tests
test: .poetry
poetry run coverage run -m pytest --durations=10

.PHONY: testcov ## Run tests and generate a coverage report
testcov: test
@echo "building coverage html"
@poetry run coverage html
@echo "building coverage lcov"
@poetry run coverage lcov

.PHONY: testcov-badge ## Generate badge after tests
testcov-badge:
@poetry run coverage-badge -o coverage.svg

lang=az

.PHONY: docs ## Generate the docs
docs:
poetry run mkdocs build -f docs/${lang}/mkdocs.yml --strict

.PHONY: docs-serve ## Serve the docs
docs-serve:
poetry run mkdocs serve -f docs/${lang}/mkdocs.yml

.PHONY: secure
secure:
poetry run bandit -r integrify --config ${SETTINGS_FILENAME}
poetry run bandit -r integrify --config pyproject.toml

.PHONY: all ## Run the standard set of checks performed in CI
all: lint testcov

.PHONY: clean ## Clear local caches and build artifacts
clean:
ifeq ($(OS),Windows_NT)
del /s /q __pycache__
del /s /q *.pyc *.pyo
del /s /q *~ .*~
del /s /q .cache
del /s /q .pytest_cache
del /s /q .ruff_cache
del /s /q htmlcov
del /s /q *.egg-info
del /s /q .coverage .coverage.*
del /s /q build
del /s /q dist
del /s /q site
del /s /q docs\_build
del /s /q coverage.xml
else
rm -rf `find . -name __pycache__`
rm -f `find . -type f -name '*.py[co]'`
rm -f `find . -type f -name '*~'`
rm -f `find . -type f -name '.*~'`
rm -rf .cache
rm -rf .pytest_cache
rm -rf .ruff_cache
rm -rf htmlcov
rm -rf *.egg-info
rm -f .coverage
rm -f .coverage.*
rm -rf build
rm -rf dist
rm -rf site
rm -rf docs/_build
rm -rf coverage.xml
endif

.PHONY: new-integration ## Create new integration folder
new-integration:
mkdir src/integrify/${name}
touch src/integrify/${name}/__init__.py src/integrify/${name}/client.py src/integrify/${name}/handlers.py src/integrify/${name}/env.py
mkdir src/integrify/${name}/schemas
touch src/integrify/${name}/schemas/__init__.py src/integrify/${name}/schemas/request.py src/integrify/${name}/schemas/response.py;

mkdir tests/${name}
touch tests/${name}/__init__.py tests/${name}/conftest.py tests/${name}/mocks.py

.PHONY: test
test:
poetry run pytest -s
mkdir docs/${lang}/docs/${name}
touch docs/${lang}/docs/${name}/about.md docs/${lang}/docs/${name}/api-reference.md
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

</p>


---

**Dokumentasiya**: [https://integrify.mmzeynalli.dev](https://integrify.mmzeynalli.dev)
Expand Down Expand Up @@ -71,10 +70,10 @@ print(resp.ok, resp.body)
### Async

```python
from integrify.epoint.asyncio import EPointRequest
from integrify.epoint import EPointAsyncRequest

# Async main loop artıq başlamışdır
resp = await EPointRequest.pay(amount=100, currency='AZN', order_id='12345678', description='Ödəniş')
resp = await EPointAsyncRequest.pay(amount=100, currency='AZN', order_id='12345678', description='Ödəniş')
print(resp.ok, resp.body)

```
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions docs/epoint/about.md → docs/az/docs/epoint/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

Sorğular uğurlu və ya uğursuz olduqda, spesifik URL-ə yönləndirmək istəyirsinizsə, bu dəyişənlərə də mühit levelində dəyər verin: `EPOINT_SUCCESS_REDIRECT_URL`, `EPOINT_FAILED_REDIRECT_URL`

## Rəsmi Dokumentasiya (v1.0.3)
## Rəsmi Dokumentasiya (v1.0.3) { #official-documentation }

[Azərbaycanca](https://epointbucket.s3.eu-central-1.amazonaws.com/files/instructions/API%20Epoint%20az.pdf)

[İngliscə](https://epointbucket.s3.eu-central-1.amazonaws.com/files/instructions/API%20Epoint%20en.pdf)

[Rusca](https://epointbucket.s3.eu-central-1.amazonaws.com/files/instructions/API%20Epoint%20ru.pdf)

## Sorğular listi
## Sorğular listi { #list-of-requests }

| Sorğu metodu | Məqsəd | EPoint API | Callback-ə sorğu atılır |
| :-------------------------- | :------------------------------------------------------------------- | :---------------------------------------: | :-----------------------: |
Expand All @@ -31,7 +31,7 @@
| `split_pay_with_saved_card` | Saxlanılmış kartla ödənişi başqa EPoint istifadəçisi ilə bölüb ödəmə | `/api/1/split-execute-pay` | :x: |
| `split_pay_and_save_card` | Ödənişi başqa EPoint istifadəçisi ilə bölüb ödəmə və kartı saxlamaq | `/api/1/split-card-registration-with-pay` | :fontawesome-solid-check: |

## Callback Sorğusu
## Callback Sorğusu { #callback-request }

Bəzi sorğular müştəri məlumat daxil etdikdən və arxa fonda bank işləmləri bitdikdən sonra, tranzaksiya haqqında məlumat sizin EPoint dashboard-da qeyd etdiyiniz `callback` URL-ə POST sorğusu göndərilir. Data siz adətən sorğu göndərdiyiniz formatda gəlir:

Expand Down Expand Up @@ -64,7 +64,7 @@ Bu data-nı `signature`-ni yoxladıqdan sonra, decode etmək lazımdır. Callbac
---
## Callback Data formatı
## Callback Data formatı { #callback-data-format }
Nə sorğu göndərməyinizdən asılı olaraq, callback-ə gələn data biraz fərqlənə bilər. `DecodedCallbackDataSchema` bütün bu dataları özündə cəmləsə də, hansı fieldlərin gəlməyəcəyini (yəni, decode-dan sonra `None` olacağını) bilmək yaxşı olar. Ümumilikdə, mümkün olacaq datalar bunlardır:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
# EPoint klientinin API Reference-i

???+ note

İstifadəsi göstərilən bütün sorğular sinxrondur. Asinxron versiyasaları istifadə etmək üçün
bu importu edin və eyni-adlı funksiyaları `await` ilə çağırın:

```python
from integrify.epoint.asyncio import EPointRequest
from integrify.epoint import EPointAsyncRequest
```

::: integrify.epoint.sync.EPointRequest
::: integrify.epoint.client.EPointRequest
::: integrify.epoint.client.EPointAsyncRequest

???+ note

Bu artıq hazır yaradılmış klass obyektidir, birbaşa istifadə üçün nəzərdə tutulub. Əks halda
Bunlar artıq hazır yaradılmış klass obyektləridir, birbaşa istifadə üçün nəzərdə tutulub. Əks halda
bütün sorğuları `EPointRequestClass().save_card()` kimi istifadə etməlisiniz.

::: integrify.epoint.sync.EPointRequestClass
::: integrify.epoint.client.EPointClientClass
handler: python
options:
members:
Expand Down
Loading

0 comments on commit 31a94df

Please sign in to comment.