Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

custom_fields with a required parameter must specify an editor parameter. #119

Open
paaacman opened this issue Sep 22, 2021 · 4 comments
Open
Labels
legacy Related to legacy, non-OpenAPI SDK

Comments

@paaacman
Copy link

Hello,

Since today, we have this error custom_fields with a required parameter must specify an editor parameter. when trying to create an embedded signature.
The template does not needs me to send custom_fields for signers. Required fields are to be set by signers.

We use hellosign-php-sdk v3.6.0.
It happen since a deployment of our application (potentiel update of dependencies) but the error is from HelloSign API.

If I remove 'required' field of the array, in AbstractSignatureRequest::setCustomFieldValue(), it's working as expected.

I found this similar issue, but I don't understand why I have this issue now. hellosign/hellosign-dotnet-sdk#68

It's not working either with hellosign-php-sdk v3.7.0.

Custom fields are parsed to JSON so null values are not removed by $request->toParams() mechanism.

The solution for me is to modify AbstractSignatureRequest::setCustomFieldValue() but it's in hellosign-php-sdk and I need a HOTFIX. Do you see any other solution?

Thanks.

@nourkilany
Copy link

We have the same problem also.

@paaacman
Copy link
Author

paaacman commented Sep 22, 2021

@nourkilany since today?

Here is my fix if it can help :

<?php

namespace Infrastructure\ExternalService\HelloSign;

use HelloSign\AbstractSignatureRequest;

class TemplateSignatureRequest extends \HelloSign\TemplateSignatureRequest
{
    /**
     * Set the value for a custom field with the given field name
     * and optionally define a Role allowed to edit it and if the field is required to be filled
     *
     * @param string $field_name field name to be filled in
     * @param string $value
     * @param string $editor
     * @param string $required
     *
     * @return AbstractSignatureRequest
     */
    public function setCustomFieldValue($field_name, $value, $editor = null, $required = null): AbstractSignatureRequest
    {
        $custom_fields = isset($this->custom_fields) ? json_decode($this->custom_fields) : [];

        $field = [
            'name' => $field_name,
            'value' => $value,
        ];

        if ($editor !== null) {
            $field['editor'] = $editor;
        }

        if ($required !== null) {
            $field['required'] = $required;
        }

        $custom_fields[] = $field;

        $this->custom_fields = json_encode($custom_fields);

        return $this;
    }
}

@nourkilany
Copy link

Yeah since their scheduled maintenance I guess.
Thanks for the solution we did something like this from our end also until they fix it.

@nuklive
Copy link

nuklive commented Sep 22, 2021

Looks like this was fixed on the API side: hellosign/hellosign-dotnet-sdk#68 (comment)
I'm not seeing the error on our end anymore.

@jtreminio-dropbox jtreminio-dropbox added the legacy Related to legacy, non-OpenAPI SDK label Mar 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
legacy Related to legacy, non-OpenAPI SDK
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants