Skip to content

Commit 1febf08

Browse files
committed
Enforce maximum height of signwell fields
Signwell have implemented a size limitation that no fields can have a height bigger than 34px. Unfortunately, their own GUI editor allows the creation of fields that are larger than this, and once one has done that they can no longer be loaded for editing or sent through the API (it appears the limitation is only in the public API and not their internal ones). So to make signing work at all, when editing a contract enforce the limit to 34px (with a warning). Things might not look very nice anymore but they should at least work. Support case has been opened with Signwell to see if this was actually intentional (the max size in the UI editor appears to be 74), and if so if they are planning to align the UI with the API. This commit goes in pending a possible change on their side and we can revert if if we end up not needing it permanently.
1 parent 738f80f commit 1febf08

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

postgresqleu/digisign/implementations/signwell.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import base64
1414
import dateutil.parser
15+
from decimal import Decimal
1516
import hashlib
1617
import hmac
1718
import json
@@ -177,6 +178,11 @@ def edit_digital_fields(self, request, conference, name, pdf, fieldjson, savecal
177178
elif f['type'] == 'datefield':
178179
f['type'] = 'date'
179180

181+
# (possibly temporary) workaround for that signwell returns fields that are bigger than they then allow us to set
182+
if Decimal(f.get('height', '0')) > 34:
183+
messages.warning(request, "Reduced size of field {} to 34 pixels due to signwell API limitation".format(f.get('api_id', '*unknown name*')))
184+
f['height'] = "34"
185+
180186
savecallback(fieldjson)
181187

182188
# Delete the temporary document
@@ -248,6 +254,11 @@ def edit_digital_fields(self, request, conference, name, pdf, fieldjson, savecal
248254
# Workaround: seems it gets returned mixed case but has to be specified lowercase!
249255
f['type'] = f['type'].lower()
250256

257+
# (possibly temporary) workaround for that signwell returns fields that are bigger than they then allow us to set
258+
if Decimal(f.get('height', '0')) > 34:
259+
messages.warning(request, "Reduced size of field {} when loading contract to 34 pixels due to signwell API limitation".format(f.get('api_id', '*unknown name*')))
260+
f['height'] = "34"
261+
251262
r = requests.post('https://www.signwell.com/api/v1/documents/', json=payload, headers={
252263
'X-Api-Key': self.provider.config.get('apikey'),
253264
}, timeout=15)

0 commit comments

Comments
 (0)