hellosign / hellosign-java-sdk

A Java SDK for the HelloSign API.
MIT License
13 stars 27 forks source link

TemplateSignatureRequest not allow to put signer accesscode #89

Open Marcocmd opened 5 years ago

Marcocmd commented 5 years ago

I need to use embedded signing using a pdf template in my web application. I nees also to generate an "One Time Password" to protect access to the signing window. So i need to use TemplateSignatureRequest using a signer with an accesscode : Signer client = new Signer(); client.setNameOrRole(name+" "+surname); client.setAccessCode(otp); signers.put("Client", client);

But then no access code is requested to sign the documet. I think there is a bug in TemplateSignatureRequest, so I extended it in my application with a new object "TemplateSignatureWithPinRequest" fixing it, but i need a confirm of it.

I added Pin code in getPostFields() method public Map<String, Serializable> getPostFields() throws HelloSignException { Map<String, Serializable> fields = super.getPostFields(); try { // Mandatory fields List templateIds = getTemplateIds(); for (int i = 0; i < templateIds.size(); i++) { fields.put(TEMPLATE_IDS + "[" + i + "]", templateIds.get(i)); } Map<String, Signer> signerz = getSigners(); for (String role : signerz.keySet()) { Signer s = signerz.get(role); fields.put(TEMPLATE_SIGNERS + "[" + role + "][" + TEMPLATE_SIGNERS_EMAIL + "]", s.getEmail()); fields.put(TEMPLATE_SIGNERS + "[" + role + "][" + TEMPLATE_SIGNERS_NAME + "]", s.getNameOrRole()); if (s.getAccessCode() != null) { fields.put(TEMPLATE_SIGNERS + "[" + role + "][" + SIGREQ_SIGNER_PIN + "]", s.getAccessCode()); } }

jspaetzel commented 4 years ago

Thanks, looks like this is a feature missing from the SDK, it sounds like what you are doing is correct to me. Does that solution work for you until we add support to the SDK in general?