From 6bb57c371d125dae2db933d3a876f952a7e03b42 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 6 Mar 2018 13:30:52 +0300 Subject: [PATCH] Yandex_update --- finance/views.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/finance/views.py b/finance/views.py index 8bd89e3..7cb1e50 100644 --- a/finance/views.py +++ b/finance/views.py @@ -242,17 +242,16 @@ class YandexCheckView(APIView): # TODO Нужно решение # pay.invoice_id = int(data['invoiceId']) # pay.save() - res = { + xml_res = dicttoxml.dicttoxml({ 'code': 0, 'shopId': int(pay.shop_id), 'invoiceId': int(data['invoiceId']), 'orderSumAmount': pay.order_amount, 'performedDatetime': datetime.datetime.now(), - } + }) + logger_yandex.info(xml_res) - logger_yandex.info(res) - - return Response(res, status=200) + return Response(xml_res, content_type='application/xml') class YandexAvisoView(APIView): @@ -278,16 +277,16 @@ class YandexAvisoView(APIView): pay.status = Payment.STATUS.SUCCESS pay.save() - res = { + xml_res = dicttoxml.dicttoxml({ 'code': 0, - 'shopId': int(pay.shop_id), + 'shopId':int(pay.shop_id), 'invoiceId': int(data['invoiceId']), 'orderSumAmount': pay.order_amount, 'performedDatetime': datetime.datetime.now(), - } - logger_yandex.info(res) + }) + logger_yandex.info(xml_res) - return Response(res, status=200) + return HttpResponse(xml_res, content_type='application/xml') class YandexFailView(APIView):