Docusign PHP SDK - предустановленное значение метки данных шаблона заполнения - PullRequest
2 голосов
/ 25 февраля 2020

ОБНОВЛЕНИЕ:

Как выяснилось, мне нужно включить этот параметр для отображения данных, и использование вкладок является правильным решением.

Когда отправляется конверт, напишите начальное значение поля для всех получателей

=============== =================================================

Не уверен, почему этот не упоминается в API должным образом ... но как можно go заполнить пользовательскую метку данных шаблона шаблоном?

Итак, я создаю шаблон, подобный следующему:

$envelope_definition = new EnvelopeDefinition([
            'status'      => 'sent',
            'template_id' => $args['template_id'],
        ]);

, затем создаю подписывающее лицо:

 $signer = new TemplateRole([
            'email'     => $args['signer_email'],
            'name'      => $args['signer_name'],
            'role_name' => 'signer',
        ]);

Вот где произошло отключение, куда я могу добавить заранее определенное значение шаблона? До сих пор я пробовал две вещи: 1. Добавить tabs к $signer примерно так, но при этом все значения полей в итоговом документе уменьшаются,

new Tabs([
                    "text_tabs" => [
                        new Text([
                            "tab_label" => "price",
                            "value"     => "123456789",
                        ]),
                    ],
                ]),

Звоните $envelope_definition->setCustomFields(), вот так:
$envelope_definition->setCustomFields(new CustomFields([
            'text_custom_fields' => [
                'price' => new Text([
                    'tab_label'     => 'price',
                    'custom_tab_id' => 'price',
                    'value'         => '123456789',
                ]),
            ],
        ]));

Это вызовет у меня ошибку C#, которую я совсем не понимаю:

Error while requesting server, received a non successful HTTP code [400] with response Body:  O:8:\"stdClass\":2:{s:9:\"errorCode\";s:20:\"INVALID_REQUEST_BODY\";s:7:\"message\";s:718:\"The request body is missing or improperly formatted. Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"}) into type 'System.Collections.Generic.List`1[API_REST.Models.v2_1.textCustomField]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.\r\nPath 'customFields.textCustomFields.price', line 1, position 45.\";}"

Документы API, кажется, фокусируются на создании шаблона и значений adho c ... у кого-нибудь есть что-то, что работает? Большое спасибо!

Ответы [ 2 ]

1 голос
/ 25 февраля 2020

Вы можете найти действительный PHP пример здесь , который показывает, как предварительно заполнить значения вкладки шаблона при создании конверта.

0 голосов
/ 26 февраля 2020

Вы не правильно следовали примеру.

Вы не создали объект \ DocuSign \ eSign \ Model \ TextCustomField.

Вот он по ссылке Амит:

    # Create an envelope custom field to save the our application's
    # data about the envelope
    $custom_field = new \DocuSign\eSign\Model\TextCustomField([
        'name' => 'app metadata item',
        'required' => 'false',
        'show' => 'true', # Yes, include in the CoC
        'value' => '1234567']);
    $custom_fields = new \DocuSign\eSign\Model\CustomFields([
        'text_custom_fields' => [$custom_field]]);
    $envelope_definition->setCustomFields($custom_fields);
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...