Merge branch 'dev_fix_pereodic_payment' into 'dev'

Dev fix pereodic payment

See merge request !417
remotes/origin/revert-6d879fe8
Administrator 8 years ago
commit b299f4cef9
  1. 4
      finance/tasks.py
  2. 12
      finance/views.py

@ -27,7 +27,9 @@ def periodic_billing():
order_amount=invoice.price, order_amount=invoice.price,
customer_number=user.id, customer_number=user.id,
user=user, user=user,
cps_email=user.email cps_email=user.email,
shop_id=settings.YANDEX_MONEY_REBILLING_SHOP_ID,
scid=settings.YANDEX_MONEY_REBILLING_SCID
) )
invoice.yandex_pay = yandex_pay invoice.yandex_pay = yandex_pay
invoice.save() invoice.save()

@ -193,6 +193,7 @@ class InvoiceDetailView(APIView):
invoice.status = status invoice.status = status
if invoice.status == "F": if invoice.status == "F":
# TODO это никогда не выполнится
invoice.real_price = invoice.real_price if real_price is None else real_price invoice.real_price = invoice.real_price if real_price is None else real_price
if bill.check_pay() and (invoice.price < price): if bill.check_pay() and (invoice.price < price):
@ -207,7 +208,7 @@ class InvoiceDetailView(APIView):
invoice.create_child_pays(pay_count) invoice.create_child_pays(pay_count)
if invoice.method == 'Y' and invoice.yandex_pay is None: if invoice.method == 'Y' and invoice.yandex_pay is None:
yandex_pay = Payment.objects.create( yandex_pay = Payment(
order_amount=invoice.price, order_amount=invoice.price,
shop_amount=0, shop_amount=0,
customer_number=bill.user.id, customer_number=bill.user.id,
@ -217,7 +218,7 @@ class InvoiceDetailView(APIView):
if pay_count > 1: if pay_count > 1:
yandex_pay.shop_id = settings.YANDEX_MONEY_REBILLING_SHOP_ID yandex_pay.shop_id = settings.YANDEX_MONEY_REBILLING_SHOP_ID
yandex_pay.scid = settings.YANDEX_MONEY_REBILLING_SCID yandex_pay.scid = settings.YANDEX_MONEY_REBILLING_SCID
yandex_pay.save()
invoice.yandex_pay = yandex_pay invoice.yandex_pay = yandex_pay
invoice.send_link() invoice.send_link()
@ -469,9 +470,10 @@ class YandexAvisoView(APIView):
}) })
pay.shop_amount = data['shopSumAmount'] pay.shop_amount = data['shopSumAmount']
invoice = pay.invoice # invoice = pay.invoice
invoice.key = data['invoiceId'] # invoice.key = data['invoiceId']
invoice.save() # invoice.save()
InvoiceRebilling.objects.filter(bill=pay.invoice.bill).update(key=data['invoiceId'])
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