-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/AntonVagabond/online_store i…
…nto dev
- Loading branch information
Showing
14 changed files
with
229 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,5 @@ TASK_SERIALIZER= | |
TIMEZONE= | ||
|
||
YOOKASSA_SHOP_ID= | ||
YOOKASSA_SECRET_KEY= | ||
YOOKASSA_SECRET_KEY= | ||
YOOKASSA_RETURN_URL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# ------------------------------------- INIT ---------------------------------------- | ||
.PHONY: init | ||
init: | ||
# Установка виртуального окружения. | ||
python -m venv venv | ||
# Активация виртуального окружения. | ||
source venv/bin/activate | ||
# Установка зависимостей проекта. | ||
pip install -r requirements.txt | ||
# ----------------------------------------------------------------------------------- | ||
|
||
|
||
# ----------------------------- MIGRATIONS AND STATIC ------------------------------- | ||
# Применить миграции и отправить. | ||
.PHONY: migrations | ||
migrations: | ||
python ./manage.py makemigrations | ||
python ./manage.py migrate | ||
|
||
# Сбор статик файлов. | ||
.PHONY: static | ||
static: | ||
python ./manage.py collectstatic | ||
# ----------------------------------------------------------------------------------- | ||
|
||
|
||
# ----------------------------------- LOAD DATA ------------------------------------- | ||
# Загрузить данные в базу данных. | ||
.PHONY: load | ||
load: | ||
python ./manage.py loaddata fixtures/categories.json | ||
python ./manage.py loaddata fixtures/providers.json | ||
python ./manage.py loaddata fixtures/products.json | ||
python ./manage.py loaddata fixtures/products_description.json | ||
python ./manage.py loaddata fixtures/products_feature.json | ||
python ./manage.py loaddata fixtures/products_images.json | ||
# ----------------------------------------------------------------------------------- | ||
|
||
|
||
# ------------------------------------- SUPERUSER ----------------------------------- | ||
# Создание суперпользователя. | ||
.PHONY: createsuperuser | ||
createsuperuser: | ||
python ./manage.py createsuperuser | ||
# ----------------------------------------------------------------------------------- | ||
|
||
|
||
# ------------------------------ RUN AND STOP SERVER -------------------------------- | ||
# Запуск сервера разработки. | ||
.PHONY: run | ||
run: | ||
python manage.py runserver | ||
|
||
# Остановка сервера разработки. | ||
.PHONY: stop | ||
stop: | ||
pkill -f "python ./manage.py runserver" | ||
# ----------------------------------------------------------------------------------- | ||
|
||
|
||
# ------------------------------------- CELERY -------------------------------------- | ||
# Запустить Celery. Убедитесь в том, что у вас запущен Redis (на WSL2, если | ||
# у вас Windows) и RabbitMQ на вашем локальном хосте! | ||
.PHONY: celery | ||
celery: | ||
celery --app=config worker --loglevel=info --pool=solo | ||
|
||
# Запустить Celery Beat для резервной копии Базы Данных. | ||
.PHONY: beat | ||
beat: | ||
celery -A config beat -l info | ||
# ----------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,10 @@ | ||
from rest_framework import serializers | ||
|
||
from payments.models.payments import OrderPayment | ||
|
||
class PaymentConfirmWebHookSerializer(serializers.Serializer): | ||
""" | ||
Сериализатор подтверждения платежа с помощью WebHook-а. | ||
Атрибуты: | ||
* `product` (PrimaryKeyRelatedField): товар. | ||
* `quantity` (IntegerField): количество одного товара. | ||
""" | ||
id = serializers.UUIDField( | ||
required=True, | ||
label='Идентификатор webhook', | ||
) | ||
status = serializers.CharField( | ||
label='Статус платежа', | ||
default='succeeded', | ||
read_only=True, | ||
) | ||
|
||
class EmptyPaymentSerializer(serializers.ModelSerializer): | ||
"""Пустой сериализатор для подтверждения заказа с помощью webhook-а.""" | ||
class Meta: | ||
model = OrderPayment | ||
fields = ('order_id',) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.urls import path, include | ||
|
||
from .views import payments | ||
|
||
urlpatterns = [ | ||
path('orders/payment_confirmation/', payments.PaymentConfirmationAPIView.as_view(), name='payment_confirmation') | ||
] | ||
|
||
|
Empty file.
Oops, something went wrong.