Implement POST method for eopayment requests (fixes #6905)

This commit is contained in:
Benjamin Dauvergne 2015-04-03 17:48:58 +02:00 committed by Thomas NOEL
parent b5bce03ae1
commit 443f885efe
1 changed files with 15 additions and 1 deletions

View File

@ -10,6 +10,7 @@ from decimal import Decimal
from quixote import (redirect, get_publisher, get_request, get_session,
get_response)
from quixote.directory import Directory
from quixote.html import TemplateIO, htmltext
if not set:
from sets import Set as set
@ -429,10 +430,23 @@ def request_payment(invoice_ids, url, add_regie=True):
if kind == eopayment.URL:
return redirect(data)
elif kind == eopayment.FORM:
raise NotImplementedError()
return return_eopayment_form(data)
else:
raise NotImplementedError()
def return_eopayment_form(form):
r = TemplateIO(html=True)
r += htmltext('<html><body onload="document.payform.submit()">')
r += htmltext('<form action="%s" method="%s" name="payform">') % (form.url, form.method)
for field in form.fields:
r += htmltext('<input type="%s" name="%s" value="%s"/>') % (
field['type'],
field['name'],
field['value'])
r += htmltext('<input type="submit" name="submit" value="%s"/>') % _('Pay')
r += htmltext('</body></html>')
return r.getvalue()
class PaymentValidationWorkflowStatusItem(WorkflowStatusItem):
description = N_('Payment Validation')