hellosign / hellosign-dotnet-sdk

A .NET SDK for the HelloSign API
MIT License
26 stars 29 forks source link

Form Field "signer" field should be string #112

Open RPM1984 opened 2 years ago

RPM1984 commented 2 years ago

Hi there!

The "signer" field form form fields is currently set to int. See here

The problem is that the API also allows us to set this as "sender" (a string) for text merge, which we currently cannot do.

From the docs:

signer - (int | string) signer index identified by the offset %i% in the signers[%i%] parameter, indicating which signer should fill out the field. If your type is 'text-merge' you can set this to 'sender', so the field is non-editable by any signer.

So i think we need to update this model to make it a string (or perhaps, an enum to make it easier for the consumer).

Happy to submit a PR for this. Thanks!

erosiec commented 2 years ago

Thanks @RPM1984 , we're looking into this now and will get back to you with an update as soon as possible.

In the meantime, you can workaround this by adding your form fields through the Client.AdditionalParameters Dictionary object.

For example:

            var request = new SignatureRequest();
            request.Title = "NDA with Acme Co.";
            request.Subject = "The NDA we talked about";
            request.Message = "Please sign this NDA and then we can discuss more. Let me know if you have any questions.";
            request.AddSigner("signer@test.com", "Signer");
            request.AddFile("Test.pdf");
            client.AdditionalParameters.Add("form_fields_per_document", "[[{\"api_id\": \"textmrg\", \"name\": \"textmerge\", \"type\":\"text-merge\",\"x\":112, \"y\":328, \"width\":25, \"height\":18, \"page\":1, \"signer\":\"sender\", \"required\":true},{\"api_id\": \"signature1\", \"name\": \"sig1\", \"type\":\"signature\",\"x\":112, \"y\":358, \"width\":35, \"height\":18, \"page\":1, \"signer\":0, \"required\":true}]]");
            client.AdditionalParameters.Add("custom_fields", "[{\"name\":\"textmrg\",\"value\":\"Test Value\"}]");
            request.TestMode = true;