summaryrefslogtreecommitdiff
path: root/postgresqleu
diff options
context:
space:
mode:
authorMagnus Hagander2025-06-24 13:11:47 +0000
committerMagnus Hagander2025-06-24 13:14:11 +0000
commit1febf08ad2ff6ff835dc51433d52d6d0766056bb (patch)
treeef1450a7d1d76c6fffaad500b3a7b76caa44abb8 /postgresqleu
parent738f80fc75113ef6522c4a15eb969d0f16f21697 (diff)
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.
Diffstat (limited to 'postgresqleu')
-rw-r--r--postgresqleu/digisign/implementations/signwell.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/postgresqleu/digisign/implementations/signwell.py b/postgresqleu/digisign/implementations/signwell.py
index 30c92d42..6de7a4e3 100644
--- a/postgresqleu/digisign/implementations/signwell.py
+++ b/postgresqleu/digisign/implementations/signwell.py
@@ -12,6 +12,7 @@ from postgresqleu.digisign.util import digisign_handlers
import base64
import dateutil.parser
+from decimal import Decimal
import hashlib
import hmac
import json
@@ -177,6 +178,11 @@ class Signwell(BaseProvider):
elif f['type'] == 'datefield':
f['type'] = 'date'
+ # (possibly temporary) workaround for that signwell returns fields that are bigger than they then allow us to set
+ if Decimal(f.get('height', '0')) > 34:
+ messages.warning(request, "Reduced size of field {} to 34 pixels due to signwell API limitation".format(f.get('api_id', '*unknown name*')))
+ f['height'] = "34"
+
savecallback(fieldjson)
# Delete the temporary document
@@ -248,6 +254,11 @@ class Signwell(BaseProvider):
# Workaround: seems it gets returned mixed case but has to be specified lowercase!
f['type'] = f['type'].lower()
+ # (possibly temporary) workaround for that signwell returns fields that are bigger than they then allow us to set
+ if Decimal(f.get('height', '0')) > 34:
+ 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*')))
+ f['height'] = "34"
+
r = requests.post('https://www.signwell.com/api/v1/documents/', json=payload, headers={
'X-Api-Key': self.provider.config.get('apikey'),
}, timeout=15)