Merge branch 'yandex_rebiling' into 'dev'

finance email

See merge request !346
master
Andrey 8 years ago
commit d522908092
  1. 10
      finance/views.py
  2. 7
      templates/yandex/test_pay.html

@ -25,13 +25,17 @@ from finance.tasks import setup_periodic_billing
from lms.global_decorators import transaction_decorator from lms.global_decorators import transaction_decorator
from lms.tools import get_real_name from lms.tools import get_real_name
from django.utils import timezone from django.utils import timezone
import uuid
logger_yandex = logging.getLogger('yandex_money') logger_yandex = logging.getLogger('yandex_money')
def test_pay(request): def test_pay(request):
return render_to_response('yandex/test_pay.html', context={ return render_to_response('yandex/test_pay.html', context={
'shop_id': settings.YANDEX_MONEY_SHOP_ID, 'sc_id': settings.YANDEX_MONEY_TEST_SCID}) 'shop_id': settings.YANDEX_MONEY_SHOP_ID,
'sc_id': settings.YANDEX_MONEY_TEST_SCID,
'order_number': str(uuid.uuid4())[:12]
})
class BillListView(APIView): class BillListView(APIView):
@ -482,7 +486,7 @@ class DemoYandexCheckView(APIView):
@staticmethod @staticmethod
def post(request): def post(request):
# Деалем допущение, что orderNumber=abc1111111 иначе всё плохо # Деалем допущение, что customerNumber=abc1111111 иначе всё плохо
data = dict() data = dict()
try: try:
for i in request.body.decode('utf-8').split('&'): for i in request.body.decode('utf-8').split('&'):
@ -496,7 +500,7 @@ class DemoYandexCheckView(APIView):
now = timezone.now() now = timezone.now()
try: try:
if data['invoiceId'] == "abc1111111": if data['customerNumber'] == "abc000":
xml_res = """<checkOrderResponse performedDatetime="%s" code="0" invoiceId="%s" shopId="%s"/> xml_res = """<checkOrderResponse performedDatetime="%s" code="0" invoiceId="%s" shopId="%s"/>
""" % (now.isoformat(), str(data['invoiceId']), str(data['shopId'])) """ % (now.isoformat(), str(data['invoiceId']), str(data['shopId']))
else: else:

@ -12,9 +12,10 @@
Больше инфы Больше инфы
<a href="https://tech.yandex.ru/money/doc/payment-solution/examples/examples-test-data-docpage/" target="_blank"> <a href="https://tech.yandex.ru/money/doc/payment-solution/examples/examples-test-data-docpage/" target="_blank">
В доке В доке
</a> </a><br>
Отправление формы срабатывает только раз затем нужно будет заменить orderNumber
</div> </div>
<br><br><br><br><br> <br><br><br>
<form action=" https://demomoney.yandex.ru/eshop.xml" method="post" target="_blank"> <form action=" https://demomoney.yandex.ru/eshop.xml" method="post" target="_blank">
<table> <table>
<tr> <tr>
@ -35,7 +36,7 @@
</tr> </tr>
<tr> <tr>
<td>orderNumber</td> <td>orderNumber</td>
<td><input name="orderNumber" value="abc1111111" type="text"/></td> <td><input name="orderNumber" value="{{ order_number }}" type="text"/></td>
</tr> </tr>
<tr> <tr>
<td>cps_phone</td> <td>cps_phone</td>

Loading…
Cancel
Save