2014-09-05 67 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

相關問題