From 17bc7be7d59a18d776951acc9b91102b0f5188b9 Mon Sep 17 00:00:00 2001 From: wad Date: Thu, 19 Apr 2018 20:06:23 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20yandex=5Finvoice=5Fid=20(=D1=85=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=82=D1=81=D1=8F=20=D0=B2=20=D0=BD=D0=B5?= =?UTF-8?q?=D0=BA=D0=BE=D0=B5=D0=BC=20key=20-=20=D0=9D=D0=90=D0=94=D0=9E?= =?UTF-8?q?=20=D0=9F=D0=95=D0=A0=D0=95=D0=98=D0=9C=D0=95=D0=9D=D0=9E=D0=92?= =?UTF-8?q?=D0=90=D0=A2=D0=AC=20)=20=D0=B4=D0=BB=D1=8F=20=D0=B2=D1=81?= =?UTF-8?q?=D0=B5=D1=85=20=D1=80=D0=B5=D0=B1=D0=B8=D0=BB=D0=B8=D0=BD=D0=B3?= =?UTF-8?q?=20=D1=81=D1=87=D0=B5=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- finance/views.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/finance/views.py b/finance/views.py index 2352592..cfb62fd 100644 --- a/finance/views.py +++ b/finance/views.py @@ -193,6 +193,7 @@ class InvoiceDetailView(APIView): invoice.status = status if invoice.status == "F": + # TODO это никогда не выполнится invoice.real_price = invoice.real_price if real_price is None else real_price if bill.check_pay() and (invoice.price < price): @@ -217,6 +218,7 @@ class InvoiceDetailView(APIView): if pay_count > 1: yandex_pay.shop_id = settings.YANDEX_MONEY_REBILLING_SHOP_ID yandex_pay.scid = settings.YANDEX_MONEY_REBILLING_SCID + yandex_pay.save() invoice.yandex_pay = yandex_pay invoice.send_link() @@ -469,9 +471,10 @@ class YandexAvisoView(APIView): }) pay.shop_amount = data['shopSumAmount'] - invoice = pay.invoice - invoice.key = data['invoiceId'] - invoice.save() + # invoice = pay.invoice + # invoice.key = data['invoiceId'] + # invoice.save() + InvoiceRebilling.objects.filter(bill=pay.invoice.bill).update(key=data['invoiceId']) pay.status = Payment.STATUS.SUCCESS now = timezone.now() pay.performed_datetime = now.isoformat() From 74d93d00d3b91969af83320a2b66e7047998fb27 Mon Sep 17 00:00:00 2001 From: wad Date: Thu, 19 Apr 2018 20:22:13 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=BF=D0=B8=D1=81=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=20YANDEX=5FMONEY=5FREBILLING=5FSHOP=5FID=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B8=D0=BD=D0=B2=D0=BE=D0=B9=D1=81=D0=BE=D0=B2?= =?UTF-8?q?=20=D1=80=D0=B5=D0=B1=D0=B8=D0=BB=D0=B8=D0=BD=D0=B3=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- finance/tasks.py | 4 +++- finance/views.py | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/finance/tasks.py b/finance/tasks.py index b51dcf5..7dca103 100644 --- a/finance/tasks.py +++ b/finance/tasks.py @@ -27,7 +27,9 @@ def periodic_billing(): order_amount=invoice.price, customer_number=user.id, 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.save() diff --git a/finance/views.py b/finance/views.py index cfb62fd..ebd8976 100644 --- a/finance/views.py +++ b/finance/views.py @@ -208,7 +208,7 @@ class InvoiceDetailView(APIView): invoice.create_child_pays(pay_count) if invoice.method == 'Y' and invoice.yandex_pay is None: - yandex_pay = Payment.objects.create( + yandex_pay = Payment( order_amount=invoice.price, shop_amount=0, customer_number=bill.user.id, @@ -218,8 +218,7 @@ class InvoiceDetailView(APIView): if pay_count > 1: yandex_pay.shop_id = settings.YANDEX_MONEY_REBILLING_SHOP_ID yandex_pay.scid = settings.YANDEX_MONEY_REBILLING_SCID - yandex_pay.save() - + yandex_pay.save() invoice.yandex_pay = yandex_pay invoice.send_link()