douxi2670
douxi2670
2018-10-22 17:21
浏览 32

如何使用PHP SDK将文本发布到模板?

We have created template via the web interface.

In template we add two text fields!

We follow DocuSign PHP SDK, and we receive test email, but without populated document.

PHP code:

$templateRole = new  \DocuSign\eSign\Model\TemplateRole();
$templateRole->setEmail("example+11000@email.com");
$templateRole->setName("NN");
$templateRole->setRoleName("Boss");

// custom textTabs
$templateRole->setTabs([
    "textTabs"=>[
        [
            "tabLabel"=>"\\*TextDate",
            "value"=> "24/10/18"
        ],
        [
            "tabLabel"=>"\\*TextName",
            "value"=> "my text"
        ]
    ]
]);

log:

POST https://demo.docusign.net:7801/restapi/v2/accounts/42****/envelopes

TraceToken: d357c21d-60f3-*********************
Timestamp: 2018-10-23T10:09:07.5516969Z

Content-Length: 356
Content-Type: application/json
Accept: application/json
Host: demo.docusign.net
User-Agent: Swagger-Codegen/2.0.1/php
X-DocuSign-Authentication: {"Username":"ms@*********.com","Password":"[omitted]","IntegratorKey":"[omitted]"}
X-DocuSign-SDK: PHP
X-SecurityProtocol-Version: TLSv1.2
X-SecurityProtocol-CipherSuite: ECDHE-RSA-AES256-**********
x-forwarded-for: 213.61.************

{"emailSubject":"[DocuSign PHP SDK] - Signature Request Sample","status":"sent","templateId":"cca2833f-de76-****************","templateRoles":[{"email":"np@**********.com","name":"NN","roleName":"boss","tabs":{"textTabs":[{"tabLabel":"\\*TextDate","value":"24/10/18"},{"tabLabel":"\\*TextName","value":"my text"}]}}]}
201 Created
Content-Type: application/json; charset=utf-8
X-DocuSign-TraceToken: d357c21d-60f3-477d-**************

{
  "envelopeId": "6833c3dc-e2e3-407e-*****************",
  "uri": "/envelopes/6833c3dc-e2e3-407e-*****************",
  "statusDateTime": "2018-10-23T10:09:07.0830000Z",
  "status": "sent"
}

UPDATE

  • We created / upload template in appdemo
  • We add text fields via admin interface
  • we want to populate this text field when run php script (docusign-php-client) or using simple CURL scripts from api documentations.
  • when run php script, we send email, but in document is not populated our text fields.

How to setup this php client to add our text in uploaded template?

Any idea?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongzu3511
    dongzu3511 2018-10-23 14:56

    Look at the signature of the setTabs() method, an \DocuSign\eSign\Model\Tabs is expected.

    • @param \DocuSign\eSign\Model\Tabs $tabs

      $tabs = new \DocuSign\eSign\Model\Tabs();
      $tab = new \DocuSign\eSign\Model\Text();
      $tab->setName('my_field');
      $tab->setTabLabel('My Label');
      $tab->setAnchorString('my_anchor_string');
      //or
      $tab->setXPosition(100);
      $tab->setYPosition(100);
      $tab->setPageNumber(1);
      
      $tabs[] = $tab;
      $templateRole->setTabs($tabs);
      ...
      
    点赞 评论

相关推荐