payments: make sure eopayment data is treated as strings (#39791)

This commit is contained in:
Frédéric Péters 2020-02-12 14:49:25 +01:00
parent 30159c1be7
commit 1a9d1bac28
1 changed files with 6 additions and 5 deletions

View File

@ -22,6 +22,7 @@ except ImportError:
pass
from wcs.qommon import _
from wcs.qommon import force_str
from wcs.qommon import errors, get_logger, get_cfg, emails
from wcs.qommon.storage import StorableObject
from wcs.qommon.form import htmltext, StringWidget, TextWidget, SingleSelectWidget, \
@ -425,7 +426,7 @@ def request_payment(invoice_ids, url, add_regie=True):
formdata.store()
if kind == eopayment.URL:
return redirect(data)
return redirect(force_str(data))
elif kind == eopayment.FORM:
return return_eopayment_form(data)
else:
@ -434,12 +435,12 @@ def request_payment(invoice_ids, url, add_regie=True):
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)
r += htmltext('<form action="%s" method="%s" name="payform">') % (force_str(form.url), force_str(form.method))
for field in form.fields:
r += htmltext('<input type="%s" name="%s" value="%s"/>') % (
field['type'],
field['name'],
field['value'])
force_str(field['type']),
force_str(field['name']),
force_str(field['value']))
r += htmltext('<input type="submit" name="submit" value="%s"/>') % _('Pay')
r += htmltext('</body></html>')
return r.getvalue()