рассрочка платежей +1 месяц, больше логирования при запросе подтверждения платежа

master
wad 8 years ago
parent 25a4de0ed0
commit 4652d67c37
  1. 2
      config_app/management/commands/for_test.py
  2. 4
      finance/models.py
  3. 7
      finance/views.py

@ -11,6 +11,6 @@ class Command(BaseCommand):
10 / 0 10 / 0
except Exception as exc: except Exception as exc:
logger.exception('FinanceLogger test log record', extra={'asdf': 3246523}, 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, 'привет': 'медвед'}
) )

@ -165,7 +165,7 @@ class InvoiceRebilling(Invoice):
def create_child_pays(self, count): def create_child_pays(self, count):
# TODO Заменить expected_date # TODO Заменить expected_date
for idx in range(int(count)-1): for idx in range(1, int(count)):
InvoiceRebilling.objects.create( InvoiceRebilling.objects.create(
bill=self.bill, bill=self.bill,
comment=self.comment, comment=self.comment,
@ -175,7 +175,7 @@ class InvoiceRebilling(Invoice):
price=self.price, price=self.price,
rebilling_on=False, rebilling_on=False,
key=self.key, key=self.key,
expected_date=(timezone.now() + relativedelta(minutes=idx+1)), expected_date=(timezone.now() + relativedelta(months=idx)),
) )
class Meta: class Meta:

@ -388,6 +388,7 @@ class YandexCheckView(APIView):
@staticmethod @staticmethod
def post(request): def post(request):
data = dict() data = dict()
# TODO заюзать url.parse https://goo.gl/s8Ygos
for i in request.body.decode('utf-8').split('&'): for i in request.body.decode('utf-8').split('&'):
key = i.split('=')[0] key = i.split('=')[0]
val = i.split('=')[1] val = i.split('=')[1]
@ -455,13 +456,9 @@ class YandexAvisoView(APIView):
request="Payment with invoice_id=%s not found" % order_number) request="Payment with invoice_id=%s not found" % order_number)
return Response(status=204) return Response(status=204)
finance_logger.info('Подтверждение платежа запрос', finance_logger.info('Подтверждение платежа запрос', request=data)
request='Get success pay with invoice_id(yandex) %s' % str(data['invoiceId']))
pay.shop_amount = data['shopSumAmount'] pay.shop_amount = data['shopSumAmount']
# invoice = pay.invoice
# invoice.key = data['invoiceId']
# invoice.save()
pay.status = Payment.STATUS.SUCCESS pay.status = Payment.STATUS.SUCCESS
now = timezone.now() now = timezone.now()
pay.performed_datetime = now.isoformat() pay.performed_datetime = now.isoformat()

Loading…
Cancel
Save