2014-09-05 112 views
1

我正在尝试在我正在构建的网站上为用户使用嵌入式签名。和错误我一直(从API浏览器,并通过自己的代码)得到的是:Docusign API - 嵌入式签名问题

“错误码”:“RECIPIENT_NOT_IN_SEQUENCE”, “消息”:“不能生成失序接收方的令牌“。

首先,我上传文件来创建一个信封,将一个收件人:

$data = array(

     'accountId' => $accountId, 
     'documents' => array(
      array(
       'documentId' => '1', 
       'name' => 'document.pdf' 
       ) 
      ), 
     'recipients' => array(
      'signers' => array(array(
        array(
         'tabs' => array(
          'signHereTabs' => array(
           array(
            "pageNumber" => "1", 
            "documentId" => "1", 
            "yPosition" => "100", 
            "xPosition" => "100", 
           ) 
          ) 
         ) 
        ), 
       'routingOrder'=> '1', 
       'recipientId'=> '1', 
       'clientUserId'=> $clientUserId, 
       'name'=> 'Signer 1', 
       'email'=> '[email protected]' 
       )) 
      ) 
      ); 

    $json_data = json_encode($data); 

    $file_contents =     
    file_get_contents("document.pdf"); 

    $requestBody = "\r\n" 
    ."\r\n" 
    ."--myboundary\r\n" 
    ."Content-Type: application/json\r\n" 
    ."Content-Disposition: form-data\r\n" 
    ."\r\n" 
    ."$json_data\r\n" 
    ."--myboundary\r\n" 
    ."Content-Type:application/pdf\r\n" 
    ."Content-Disposition: file; filename=\”document.pdf\"; documentid=1 \r\n" 
    ."\r\n" 
    ."$file_contents\r\n" 
    ."--myboundary--\r\n" 
    ."\r\n"; 

    // *** append "/envelopes" to baseUrl and as signature request endpoint 
    $curl = curl_init($baseUrl . "/envelopes"); 
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($curl, CURLOPT_POST, true); 
    curl_setopt($curl, CURLOPT_POSTFIELDS, $requestBody);                 
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(                   
    'Content-Type: multipart/form-data;boundary=myboundary', 
    'Content-Length: ' . strlen($requestBody), 
    "X-DocuSign-Authentication: $header")                  
    ); 

然后我送它关闭让收件人地址的签名查看:

$data = array("returnUrl" => "http://quidfs.bfclients.com/dashboard", 
      "authenticationMethod" => "None", 
      "email" => '[email protected]', 
      "userName" => 'Signer 1', 
      "clientUserId" => $clientUserId, 
     );                  


$data_string = json_encode($data);                     

$curl = curl_init($baseUrl . "/envelopes/$envelopeId/views/recipient"); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($curl, CURLOPT_POST, true); 
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);                 
curl_setopt($curl, CURLOPT_HTTPHEADER, array(                   
      'Content-Type: application/json',                     
      'Content-Length: ' . strlen($data_string), 
      "X-DocuSign-Authentication: $header")                  
     ); 

有什么想法?提前致谢。

+0

请张贴的'账户/ {}帐户ID结果/袋/ {} envelopeId/recipients',所以我们可以看到,'$ clientUserId'是通过的实际值 – Andrew 2014-09-05 20:01:02

回答

5

我没有看到你在你的请求中指定状态,所以我想这可能是你的问题。如果您在创建时未指定信封状态,我相信系统会默认将信封保存为草稿,而不是立即发送。

两个接受的状态值是createdsent。将状态设置为created,然后保存到您的草稿文件夹中,以便稍后发送。将状态设置为sent会立即发送请求。

尝试添加到您的请求主体,是这样的:

$data = array(
    'status' => 'sent', 
    'accountId' => $accountId, 
    'documents' => array(
     array(
      'documentId' => '1', 
      'name' => 'document.pdf' 
      ) 
     ), 
    'recipients' => array(
     'signers' => array(array(
       array(
        'tabs' => array(
         'signHereTabs' => array(
          array(
           "pageNumber" => "1", 
           "documentId" => "1", 
           "yPosition" => "100", 
           "xPosition" => "100", 
          ) 
         ) 
        ) 
       ), 
      'routingOrder'=> '1', 
      'recipientId'=> '1', 
      'clientUserId'=> $clientUserId, 
      'name'=> 'Signer 1', 
      'email'=> '[email protected]' 
      )) 
     ) 
    ); 
+0

就是这样。 (添加状态=>发送工作)谢谢! – btothez 2014-09-08 13:59:11

相关问题