From 4652d67c37ef3f196de47874e3c48ea3de1bf599 Mon Sep 17 00:00:00 2001 From: wad Date: Mon, 23 Apr 2018 19:28:35 +0300 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B0=D1=81=D1=81=D1=80=D0=BE=D1=87?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D0=BB=D0=B0=D1=82=D0=B5=D0=B6=D0=B5=D0=B9?= =?UTF-8?q?=20+1=20=D0=BC=D0=B5=D1=81=D1=8F=D1=86,=20=D0=B1=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D1=88=D0=B5=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D1=81=D0=B5=20=D0=BF=D0=BE=D0=B4=D1=82=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D0=B6=D0=B4=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BB?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=B6=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config_app/management/commands/for_test.py | 2 +- finance/models.py | 4 ++-- finance/views.py | 7 ++----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/config_app/management/commands/for_test.py b/config_app/management/commands/for_test.py index 64425fe..c0172e6 100644 --- a/config_app/management/commands/for_test.py +++ b/config_app/management/commands/for_test.py @@ -11,6 +11,6 @@ class Command(BaseCommand): 10 / 0 except Exception as exc: logger.exception('FinanceLogger test log record', extra={'asdf': 3246523}, - invoice_id=42, exc={'a': 1, 'b': 3, 'привет': 'медвед'} + invoice_id=42, some_param={'a': 1, 'b': 3, 'привет': 'медвед'} ) diff --git a/finance/models.py b/finance/models.py index 17bd8a0..3e7725f 100755 --- a/finance/models.py +++ b/finance/models.py @@ -165,7 +165,7 @@ class InvoiceRebilling(Invoice): def create_child_pays(self, count): # TODO Заменить expected_date - for idx in range(int(count)-1): + for idx in range(1, int(count)): InvoiceRebilling.objects.create( bill=self.bill, comment=self.comment, @@ -175,7 +175,7 @@ class InvoiceRebilling(Invoice): price=self.price, rebilling_on=False, key=self.key, - expected_date=(timezone.now() + relativedelta(minutes=idx+1)), + expected_date=(timezone.now() + relativedelta(months=idx)), ) class Meta: diff --git a/finance/views.py b/finance/views.py index 31fdd34..d9b09b8 100644 --- a/finance/views.py +++ b/finance/views.py @@ -388,6 +388,7 @@ class YandexCheckView(APIView): @staticmethod def post(request): data = dict() + # TODO заюзать url.parse https://goo.gl/s8Ygos for i in request.body.decode('utf-8').split('&'): key = i.split('=')[0] val = i.split('=')[1] @@ -455,13 +456,9 @@ class YandexAvisoView(APIView): request="Payment with invoice_id=%s not found" % order_number) return Response(status=204) - finance_logger.info('Подтверждение платежа запрос', - request='Get success pay with invoice_id(yandex) %s' % str(data['invoiceId'])) + finance_logger.info('Подтверждение платежа запрос', request=data) pay.shop_amount = data['shopSumAmount'] - # invoice = pay.invoice - # invoice.key = data['invoiceId'] - # invoice.save() pay.status = Payment.STATUS.SUCCESS now = timezone.now() pay.performed_datetime = now.isoformat()