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()