Merge branch 'yandex_rebiling' into 'dev'

finance email

See merge request !342
master
Andrey 8 years ago
commit 755c4e9aba
  1. 24
      finance/views.py
  2. 1
      templates/yandex/test_pay.html

@ -484,20 +484,30 @@ class DemoYandexCheckView(APIView):
def post(request):
# Деалем допущение, что orderNumber=abc1111111 иначе всё плохо
data = dict()
try:
for i in request.body.decode('utf-8').split('&'):
key = i.split('=')[0]
val = i.split('=')[1]
data[key] = val
except IndexError:
logger_yandex.error(
"Не предвиденная ошибка проверки тестогого платежа", request.body.decode('utf-8').split('&'))
return Response(status=204)
now = timezone.now()
if data['orderSumAmount'] == "abc1111111":
try:
if data['invoiceId'] == "abc1111111":
xml_res = """<checkOrderResponse performedDatetime="%s" code="0" invoiceId="%s" shopId="%s"/>
""" % (now.isoformat(), str(data['invoiceId']), str(data['shop_id']))
""" % (now.isoformat(), str(data['invoiceId']), str(data['shopId']))
else:
logger_yandex.warning("Ошибка проверки тестогого платежа (скорее всего так было задуманно)")
xml_res = """<checkOrderResponse performedDatetime="%s" code="100" invoiceId="%s" shopId="%s"
message="Неверный номер ордера"/>""" % (now.isoformat(), str(data['invoiceId']), str(data['shop_id']))
message="Неверный номер ордера"/>""" % (now.isoformat(), str(data['invoiceId']), str(data['shopId']))
logger_yandex.warning("Ошибка проверки тестогого платежа (скорее всего так было задуманно)", xml_res)
return HttpResponse(xml_res, content_type='application/xml')
except KeyError:
logger_yandex.error(
"Не предвиденная ошибка проверки тестогого платежа", data)
return Response(status=204)
class DemoYandexAvisoView(APIView):
@ -513,10 +523,10 @@ class DemoYandexAvisoView(APIView):
now = timezone.now()
if data['orderSumAmount'] < 1001:
xml_res = """<checkOrderResponse performedDatetime="%s" code="0" invoiceId="%s" shopId="%s"/>
""" % (now.isoformat(), str(data['invoiceId']), str(data['shop_id']))
""" % (now.isoformat(), str(data['invoiceId']), str(data['shopId']))
else:
logger_yandex.warning("Ошибка подтверждения тестогого платежа (скорее всего так было задуманно)")
xml_res = """<checkOrderResponse performedDatetime="%s" code="100" invoiceId="%s" shopId="%s"
message="Нам не позволяет совесть принять от вас более 1000 рублей"/
>""" % (now.isoformat(), str(data['invoiceId']), str(data['shop_id']))
>""" % (now.isoformat(), str(data['invoiceId']), str(data['shopId']))
logger_yandex.warning("Ошибка подтверждения тестогого платежа (скорее всего так было задуманно)", xml_res)
return HttpResponse(xml_res, content_type='application/xml')

@ -11,6 +11,7 @@
Код CVV: 000 <br>
Больше инфы https://tech.yandex.ru/money/doc/payment-solution/examples/examples-test-data-docpage/
</div>
<br><br><br><br><br>
<form action=" https://demomoney.yandex.ru/eshop.xml" method="post" target="_blank">
<table>
<tr>

Loading…
Cancel
Save