Merge branch 'dev_fix_pereodic_payment' into 'dev'

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

See merge request !424
master
Вадим Шандринов 8 years ago
commit d8e641343d
  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
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, 'привет': 'медвед'}
)

@ -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:

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

Loading…
Cancel
Save