From cddadba7d8f3478092c2307edbf76fb3efe3a241 Mon Sep 17 00:00:00 2001 From: nikita Date: Sat, 17 Nov 2018 18:19:42 +0300 Subject: [PATCH 01/19] certificate fix --- apps/payment/templates/payment/gift_certificate_item.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/payment/templates/payment/gift_certificate_item.html b/apps/payment/templates/payment/gift_certificate_item.html index 5f4a318e..c8860157 100644 --- a/apps/payment/templates/payment/gift_certificate_item.html +++ b/apps/payment/templates/payment/gift_certificate_item.html @@ -8,9 +8,8 @@
- {% if user_gift_certificate and not user_gift_certificate.bonuses_sent %} - подарочный сертификат - {% else %}подарочный сертификат{% endif %} + Подарочный сертификат +
{{ gift_certificate.price|floatformat:"-2" }}₽
{% if user_gift_certificate %} @@ -22,7 +21,7 @@ {% else %}
- Ожидает получения + Ожидает получения | Код {{ user_gift_certificate.code }}
{% endif %} {% else %} From d7e9345e153e2acd713887498eb7d9a72f1a497c Mon Sep 17 00:00:00 2001 From: nikita Date: Sat, 17 Nov 2018 18:23:41 +0300 Subject: [PATCH 02/19] certificate fix --- apps/payment/templates/payment/gift_certificate_item.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/payment/templates/payment/gift_certificate_item.html b/apps/payment/templates/payment/gift_certificate_item.html index c8860157..7d4d3d8f 100644 --- a/apps/payment/templates/payment/gift_certificate_item.html +++ b/apps/payment/templates/payment/gift_certificate_item.html @@ -21,7 +21,7 @@ {% else %}
- Ожидает получения | Код {{ user_gift_certificate.code }} + Ожидает получения | Код {{ user_gift_certificate.code }}
{% endif %} {% else %} From bc74152b0f3ada5f14b764331dfec431bbe7da01 Mon Sep 17 00:00:00 2001 From: nikita Date: Sat, 17 Nov 2018 19:02:16 +0300 Subject: [PATCH 03/19] certificate fix --- apps/user/templates/user/bonus-history.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/user/templates/user/bonus-history.html b/apps/user/templates/user/bonus-history.html index d0035b54..11c67381 100644 --- a/apps/user/templates/user/bonus-history.html +++ b/apps/user/templates/user/bonus-history.html @@ -49,6 +49,8 @@ {% with payment=bonus.payment %} {% if payment.course %}
Курс. {{ payment.course.title }}
+ {% elif payment.giftcertificate %} +
Подарочный сертификат
{% else %}
{% if request.user_agent.is_mobile %} From 4eb672d9f0821af988ff6704ab0ab438ade60416 Mon Sep 17 00:00:00 2001 From: gzbender Date: Mon, 19 Nov 2018 13:02:10 +0300 Subject: [PATCH 04/19] =?UTF-8?q?LIL-708=20=D0=9E=D1=88=D0=B8=D0=B1=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=81=20=D0=BF=D0=BE=D0=B4=D0=B0=D1=80=D0=BE=D1=87?= =?UTF-8?q?=D0=BD=D1=8B=D0=BC=D0=B8=20=D1=81=D0=B5=D1=80=D1=82=D0=B8=D1=84?= =?UTF-8?q?=D0=B8=D0=BA=D0=B0=D1=82=D0=B0=D0=BC=D0=B8=20=D0=B2=20=D0=B0?= =?UTF-8?q?=D0=B4=D0=BC=D0=B8=D0=BD=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/serializers/payment.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/api/v1/serializers/payment.py b/api/v1/serializers/payment.py index 0ac2d12a..8d50f217 100644 --- a/api/v1/serializers/payment.py +++ b/api/v1/serializers/payment.py @@ -3,7 +3,7 @@ from rest_framework import serializers from apps.payment.models import ( AuthorBalance, Payment, CoursePayment, SchoolPayment, -) + GiftCertificatePayment) from .user import UserSerializer from .course import CourseSerializer @@ -114,6 +114,8 @@ class PaymentSerializer(serializers.ModelSerializer): return CoursePaymentSerializer(instance, context=self.context).to_representation(instance) elif isinstance(instance, SchoolPayment): return SchoolPaymentSerializer(instance, context=self.context).to_representation(instance) + elif isinstance(instance, GiftCertificatePayment): + return GiftCertificatePaymentSerializer(instance, context=self.context).to_representation(instance) class CoursePaymentCreateSerializer(serializers.ModelSerializer): @@ -181,3 +183,20 @@ class SchoolPaymentSerializer(serializers.ModelSerializer): 'created_at', 'update_at', ) + + +class GiftCertificatePaymentSerializer(serializers.ModelSerializer): + user = UserSerializer() + + class Meta: + model = GiftCertificatePayment + fields = BASE_PAYMENT_FIELDS + ( + 'gift_certificate', + ) + read_only_fields = ( + 'id', + 'user', + 'course', + 'created_at', + 'update_at', + ) From fb1c19d1015d5316f6b2e7944b24160594cc4996 Mon Sep 17 00:00:00 2001 From: gzbender Date: Wed, 21 Nov 2018 14:56:30 +0300 Subject: [PATCH 05/19] =?UTF-8?q?LIL-709=20=D0=9D=D0=B5=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D1=8F=D1=8E=D1=82=D1=81=D1=8F=20?= =?UTF-8?q?=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=B2=20roistat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 1e16fc89..4ebf7c43 100644 --- a/requirements.txt +++ b/requirements.txt @@ -34,3 +34,4 @@ pusher==2.0.1 short_url sendgrid drf_dynamic_fields +flower==0.9.2 From 858f9f9064cd2c59fa1ed48fb91a1d47356104b6 Mon Sep 17 00:00:00 2001 From: gzbender Date: Thu, 22 Nov 2018 21:17:17 +0300 Subject: [PATCH 06/19] =?UTF-8?q?LIL-710=20=D0=9E=D1=82=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D0=B0=D1=80=D1=85=D0=B8=D0=B2=D0=BD=D1=8B?= =?UTF-8?q?=D1=85=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B2=20roista?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/send_transactions_to_roistat.py | 34 +++++++++++++++++++ apps/payment/views.py | 4 +-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 apps/payment/management/commands/send_transactions_to_roistat.py diff --git a/apps/payment/management/commands/send_transactions_to_roistat.py b/apps/payment/management/commands/send_transactions_to_roistat.py new file mode 100644 index 00000000..fa18c1d8 --- /dev/null +++ b/apps/payment/management/commands/send_transactions_to_roistat.py @@ -0,0 +1,34 @@ +from django.core.management.base import BaseCommand, CommandError +from django.utils.timezone import now +from paymentwall.pingback import Pingback + +from apps.payment.tasks import transaction_to_roistat +from apps.payment.models import Payment + + +class Command(BaseCommand): + help = 'Send ' + + def add_arguments(self, parser): + parser.add_argument( + 'start_id', type=int, + help='Start payment id', + ) + + def handle(self, *args, **options): + start_id = options.get('start_id') + payments = Payment.objects.filter(id__gte=start_id, status__in=Payment.PW_PAID_STATUSES) + for payment in payments: + pingback = Pingback(payment.data) + splitted = pingback.get_product().get_id().split('_') + product_type_name, payment_id = '_'.join(splitted[:-1]), splitted[-1] + transaction_to_roistat.delay( + payment.user.id, + payment.id, + f'{product_type_name.title()} payment', + payment.amount, + now().strftime('%Y-%m-%d %H:%M:%S'), + pingback.get_type(), + product_type_name, + payment.roistat_visit, + ) diff --git a/apps/payment/views.py b/apps/payment/views.py index ec9bef56..b9491321 100644 --- a/apps/payment/views.py +++ b/apps/payment/views.py @@ -211,8 +211,8 @@ class PaymentwallCallbackView(View): pingback = Pingback(payment_raw_data, self.get_request_ip()) if pingback.validate(): - spltted = pingback.get_product().get_id().split('_') - product_type_name, payment_id = '_'.join(spltted[:-1]), spltted[-1] + splitted = pingback.get_product().get_id().split('_') + product_type_name, payment_id = '_'.join(splitted[:-1]), splitted[-1] if product_type_name == 'course': product_payment_class = CoursePayment From 337a6b95ab387b1c0bbf1e33721dab926fc48165 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 23 Nov 2018 01:57:25 +0300 Subject: [PATCH 07/19] flower --- docker/conf/nginx/conf.d/default.conf | 21 +++++++++++++++++++++ docker/conf/supervisor/flower.conf | 14 ++++++++++++++ docker/docker-compose-review.yml | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 docker/conf/supervisor/flower.conf diff --git a/docker/conf/nginx/conf.d/default.conf b/docker/conf/nginx/conf.d/default.conf index b20174f6..f78513ae 100644 --- a/docker/conf/nginx/conf.d/default.conf +++ b/docker/conf/nginx/conf.d/default.conf @@ -1,3 +1,24 @@ +server { + listen 80; + server_name ~^flower.+; + + root /dev/null; + + access_log off; + error_log /dev/stdout; + + log_not_found off; + + location / { + proxy_pass http://127.0.0.1:5555; + proxy_set_header Host $host; + proxy_redirect off; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } +} + server { listen 80 default_server; diff --git a/docker/conf/supervisor/flower.conf b/docker/conf/supervisor/flower.conf new file mode 100644 index 00000000..0d4bee32 --- /dev/null +++ b/docker/conf/supervisor/flower.conf @@ -0,0 +1,14 @@ +[program:celery] +command=/usr/local/bin/flower --config=settings --address=0.0.0.0 +directory=/app/ +environment=HOME="/var/www" +autostart=true +autorestart=true +user=www-data +redirect_stderr=true +stopsignal=KILL +stopasgroup=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stdout +stderr_logfile_maxbytes=0 diff --git a/docker/docker-compose-review.yml b/docker/docker-compose-review.yml index 9413f978..69540427 100644 --- a/docker/docker-compose-review.yml +++ b/docker/docker-compose-review.yml @@ -48,7 +48,7 @@ services: - internal - review labels: - - traefik.frontend.rule=Host:${REVIEW_HOST} + - traefik.frontend.rule=Host:${REVIEW_HOST},flower-${REVIEW_HOST} - traefik.docker.network=review networks: From 53994f97972c4d4f4df4869f1e8454d6fa1def4d Mon Sep 17 00:00:00 2001 From: root Date: Fri, 23 Nov 2018 02:03:33 +0300 Subject: [PATCH 08/19] flower --- docker/conf/supervisor/flower.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/conf/supervisor/flower.conf b/docker/conf/supervisor/flower.conf index 0d4bee32..1d8c2912 100644 --- a/docker/conf/supervisor/flower.conf +++ b/docker/conf/supervisor/flower.conf @@ -1,4 +1,4 @@ -[program:celery] +[program:flower] command=/usr/local/bin/flower --config=settings --address=0.0.0.0 directory=/app/ environment=HOME="/var/www" From 0414f8a8b0211cbb6944ca8b8279b5ca03c896be Mon Sep 17 00:00:00 2001 From: root Date: Fri, 23 Nov 2018 02:11:03 +0300 Subject: [PATCH 09/19] flower --- docker/conf/supervisor/flower.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/conf/supervisor/flower.conf b/docker/conf/supervisor/flower.conf index 1d8c2912..d89b494d 100644 --- a/docker/conf/supervisor/flower.conf +++ b/docker/conf/supervisor/flower.conf @@ -1,5 +1,5 @@ [program:flower] -command=/usr/local/bin/flower --config=settings --address=0.0.0.0 +command=/usr/local/bin/flower -A project directory=/app/ environment=HOME="/var/www" autostart=true From 84ffa8da6598400b6fc11274b80e1b48a878da3b Mon Sep 17 00:00:00 2001 From: gzbender Date: Fri, 23 Nov 2018 04:01:07 +0300 Subject: [PATCH 10/19] LIL-710 --- .../payment/management/commands/send_transactions_to_roistat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/payment/management/commands/send_transactions_to_roistat.py b/apps/payment/management/commands/send_transactions_to_roistat.py index fa18c1d8..f82d2313 100644 --- a/apps/payment/management/commands/send_transactions_to_roistat.py +++ b/apps/payment/management/commands/send_transactions_to_roistat.py @@ -27,7 +27,7 @@ class Command(BaseCommand): payment.id, f'{product_type_name.title()} payment', payment.amount, - now().strftime('%Y-%m-%d %H:%M:%S'), + payment.update_at.strftime('%Y-%m-%d %H:%M:%S'), pingback.get_type(), product_type_name, payment.roistat_visit, From 7d0ad235ef99ede0d9beb159738d70990319c4f2 Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 23 Nov 2018 11:05:32 +0300 Subject: [PATCH 11/19] command fixes --- .../management/commands/send_transactions_to_roistat.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/payment/management/commands/send_transactions_to_roistat.py b/apps/payment/management/commands/send_transactions_to_roistat.py index f82d2313..af53c7ee 100644 --- a/apps/payment/management/commands/send_transactions_to_roistat.py +++ b/apps/payment/management/commands/send_transactions_to_roistat.py @@ -5,6 +5,9 @@ from paymentwall.pingback import Pingback from apps.payment.tasks import transaction_to_roistat from apps.payment.models import Payment +import logging +logger = logging.getLogger(__name__) + class Command(BaseCommand): help = 'Send ' @@ -19,10 +22,12 @@ class Command(BaseCommand): start_id = options.get('start_id') payments = Payment.objects.filter(id__gte=start_id, status__in=Payment.PW_PAID_STATUSES) for payment in payments: + logger.info('TRANSACTION: ' + payment.id) + pingback = Pingback(payment.data) splitted = pingback.get_product().get_id().split('_') product_type_name, payment_id = '_'.join(splitted[:-1]), splitted[-1] - transaction_to_roistat.delay( + transaction_to_roistat( payment.user.id, payment.id, f'{product_type_name.title()} payment', From 1fb48607e902481b4fd53cacef9dec2c81f5da2d Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 23 Nov 2018 11:07:50 +0300 Subject: [PATCH 12/19] command fixes --- .../payment/management/commands/send_transactions_to_roistat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/payment/management/commands/send_transactions_to_roistat.py b/apps/payment/management/commands/send_transactions_to_roistat.py index af53c7ee..3db2e864 100644 --- a/apps/payment/management/commands/send_transactions_to_roistat.py +++ b/apps/payment/management/commands/send_transactions_to_roistat.py @@ -22,7 +22,7 @@ class Command(BaseCommand): start_id = options.get('start_id') payments = Payment.objects.filter(id__gte=start_id, status__in=Payment.PW_PAID_STATUSES) for payment in payments: - logger.info('TRANSACTION: ' + payment.id) + logger.info('TRANSACTION: ' + str(payment.id)) pingback = Pingback(payment.data) splitted = pingback.get_product().get_id().split('_') From 296d988d08b4642aa5ae6e3dbc32da14a6bf6837 Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 23 Nov 2018 11:27:05 +0300 Subject: [PATCH 13/19] command fixes --- .../management/commands/send_transactions_to_roistat.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/payment/management/commands/send_transactions_to_roistat.py b/apps/payment/management/commands/send_transactions_to_roistat.py index 3db2e864..cd5ab662 100644 --- a/apps/payment/management/commands/send_transactions_to_roistat.py +++ b/apps/payment/management/commands/send_transactions_to_roistat.py @@ -24,16 +24,13 @@ class Command(BaseCommand): for payment in payments: logger.info('TRANSACTION: ' + str(payment.id)) - pingback = Pingback(payment.data) - splitted = pingback.get_product().get_id().split('_') - product_type_name, payment_id = '_'.join(splitted[:-1]), splitted[-1] transaction_to_roistat( payment.user.id, payment.id, - f'{product_type_name.title()} payment', + f'Payment {payment.id}', payment.amount, payment.update_at.strftime('%Y-%m-%d %H:%M:%S'), - pingback.get_type(), - product_type_name, + 0, + f'Payment {payment.id}', payment.roistat_visit, ) From 2685f36e01d82fc2d22a100ea1f22ef896b4740d Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 23 Nov 2018 12:29:19 +0300 Subject: [PATCH 14/19] command fixes --- .../management/commands/send_transactions_to_roistat.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/payment/management/commands/send_transactions_to_roistat.py b/apps/payment/management/commands/send_transactions_to_roistat.py index cd5ab662..15a50e38 100644 --- a/apps/payment/management/commands/send_transactions_to_roistat.py +++ b/apps/payment/management/commands/send_transactions_to_roistat.py @@ -20,9 +20,11 @@ class Command(BaseCommand): def handle(self, *args, **options): start_id = options.get('start_id') + print('start_id=' + str(start_id)) + payments = Payment.objects.filter(id__gte=start_id, status__in=Payment.PW_PAID_STATUSES) for payment in payments: - logger.info('TRANSACTION: ' + str(payment.id)) + print('TRANSACTION: ' + str(payment.id)) transaction_to_roistat( payment.user.id, From 9d7955f97dd6c10db10b391fc05a854ea7a069da Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 23 Nov 2018 12:36:27 +0300 Subject: [PATCH 15/19] command fixes --- .../management/commands/send_transactions_to_roistat.py | 3 ++- apps/payment/tasks.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/payment/management/commands/send_transactions_to_roistat.py b/apps/payment/management/commands/send_transactions_to_roistat.py index 15a50e38..14ee6ee6 100644 --- a/apps/payment/management/commands/send_transactions_to_roistat.py +++ b/apps/payment/management/commands/send_transactions_to_roistat.py @@ -26,7 +26,7 @@ class Command(BaseCommand): for payment in payments: print('TRANSACTION: ' + str(payment.id)) - transaction_to_roistat( + result = transaction_to_roistat( payment.user.id, payment.id, f'Payment {payment.id}', @@ -36,3 +36,4 @@ class Command(BaseCommand): f'Payment {payment.id}', payment.roistat_visit, ) + print('RESULT' + str(result)) diff --git a/apps/payment/tasks.py b/apps/payment/tasks.py index e30f4e19..3b15a50f 100644 --- a/apps/payment/tasks.py +++ b/apps/payment/tasks.py @@ -56,3 +56,5 @@ def transaction_to_roistat(user_id, payment_id, event_name, amount, time, status url = settings.ROISTAT_API_URL + f'/project/add-orders?key={key}&project={project}' resp = requests.post(url, json=body) logger.info('TRANSACTION_TO_ROISTAT: ' + str(resp)) + + return resp From 4002617cca1fb2e67b9faedd33318adfb044020c Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 23 Nov 2018 12:42:28 +0300 Subject: [PATCH 16/19] command fixes --- .../payment/management/commands/send_transactions_to_roistat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/payment/management/commands/send_transactions_to_roistat.py b/apps/payment/management/commands/send_transactions_to_roistat.py index 14ee6ee6..6b47ab32 100644 --- a/apps/payment/management/commands/send_transactions_to_roistat.py +++ b/apps/payment/management/commands/send_transactions_to_roistat.py @@ -32,7 +32,7 @@ class Command(BaseCommand): f'Payment {payment.id}', payment.amount, payment.update_at.strftime('%Y-%m-%d %H:%M:%S'), - 0, + f'PINGBACK_TYPE_REGULAR', f'Payment {payment.id}', payment.roistat_visit, ) From d7c1c38c88a747eea9231783130cd7036200f8c9 Mon Sep 17 00:00:00 2001 From: gzbender Date: Fri, 23 Nov 2018 13:37:24 +0300 Subject: [PATCH 17/19] LIL-710 --- apps/payment/tasks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/payment/tasks.py b/apps/payment/tasks.py index e30f4e19..58abb7b2 100644 --- a/apps/payment/tasks.py +++ b/apps/payment/tasks.py @@ -56,3 +56,4 @@ def transaction_to_roistat(user_id, payment_id, event_name, amount, time, status url = settings.ROISTAT_API_URL + f'/project/add-orders?key={key}&project={project}' resp = requests.post(url, json=body) logger.info('TRANSACTION_TO_ROISTAT: ' + str(resp)) + print('TRANSACTION_TO_ROISTAT', str(resp.json())) From be73a44d1a71f15a3fb972d33a6cfa3c5e2c79c4 Mon Sep 17 00:00:00 2001 From: nikita Date: Sat, 24 Nov 2018 17:13:58 +0300 Subject: [PATCH 18/19] https://github.com/celery/celery/issues/5175 fix --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 4ebf7c43..6107112a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ # Python-3.6 arrow==0.12.1 +redis==2.10.6 celery[redis]==4.2.0 Django==2.0.7 django-active-link==0.1.5 From dc4c4a81ed07633b9bee1ba20fd6ecced24ee30e Mon Sep 17 00:00:00 2001 From: nikita Date: Sat, 24 Nov 2018 19:04:22 +0300 Subject: [PATCH 19/19] roistat command fix --- .../commands/send_transactions_to_roistat.py | 11 +++++------ apps/payment/tasks.py | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/payment/management/commands/send_transactions_to_roistat.py b/apps/payment/management/commands/send_transactions_to_roistat.py index 76131857..f5569984 100644 --- a/apps/payment/management/commands/send_transactions_to_roistat.py +++ b/apps/payment/management/commands/send_transactions_to_roistat.py @@ -26,14 +26,13 @@ class Command(BaseCommand): for payment in payments: print('TRANSACTION: ' + str(payment.id)) - result = transaction_to_roistat( + transaction_to_roistat.delay( payment.user.id, payment.id, - f'Payment {payment.id}', + f'School payment', payment.amount, - payment.update_at.strftime('%Y-%m-%d %H:%M:%S'), - f'PINGBACK_TYPE_REGULAR', - f'Payment {payment.id}', + payment.created_at.strftime('%Y-%m-%d %H:%M:%S'), + 0, + f'school', payment.roistat_visit, ) - print('RESULT' + str(result.json())) diff --git a/apps/payment/tasks.py b/apps/payment/tasks.py index 824e7272..e30f4e19 100644 --- a/apps/payment/tasks.py +++ b/apps/payment/tasks.py @@ -56,4 +56,3 @@ def transaction_to_roistat(user_id, payment_id, event_name, amount, time, status url = settings.ROISTAT_API_URL + f'/project/add-orders?key={key}&project={project}' resp = requests.post(url, json=body) logger.info('TRANSACTION_TO_ROISTAT: ' + str(resp)) - return resp