2017-05-23 2 views
0

DocuSign Apis를 처음 사용하는 순간입니다. DocuSign 템플릿에 predata가 채워지는 문제가 있습니다. 코드 서식 파일에서 동적 수신자를 추가 할 때 이메일을 보내는 동안 데이터를 추가하고 사용자에게 보내는 대신 공백으로 표시됩니다. 누구든지 도와 줄 수 있습니까?Docusign에서 데이터 채우기가 일어나지 않습니다

아래는 내 코드입니다 :

<?php 
// Input your info here: 
$name = ""; 
$email = ''; 
$integratorKey = ''; 
$password = ''; 
$email1 = '[email protected]'; 
$templateId = "826e138e-7ad6-4ceb-853b-f545be643527"; 

$header = "<DocuSignCredentials> 
    <Username>" . $email . "</Username> 
    <Password>" . $password . "</Password> 
    <IntegratorKey>" . $integratorKey . "</IntegratorKey></DocuSignCredentials>"; 

$url = "https://demo.docusign.net/restapi/v2/login_information"; 
$curl = curl_init($url); 
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($curl, CURLOPT_HEADER, false); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    "X-DocuSign-Authentication: $header" 
)); 
$json_response = curl_exec($curl); 
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE); 

if ($status != 200) 
{ 
echo "Error calling webservice, status is:" . $status; 
exit(-1); 
} 

$response = json_decode($json_response, true); 
$accountId = $response["loginAccounts"][0]["accountId"]; 
$baseUrl = $response["loginAccounts"][0]["baseUrl"]; 
curl_close($curl); 

$data = array(
    "accountId" => $accountId, 
    "emailSubject" => "DocuSign Templates Webinar - Example 2", 
    "emailBlurb" => "Example #2 - Dynamically Populate Form Fields", 
    "templateId" => $templateId, 
    "templateRoles" => array(
     array(
      "email" => $email, 
      "name" => $name, 
      "roleName" => "Developer", 
      "tabs" => array(
       "textTabs" => array(
        array(
         "tabLabel" => "ApplicantSSN", 
         "value" => "test test456456" 
        ) , 
       ) 
      ) 
     ) 
    ) , 
    "status" => "sent" 
); 

$data_string = json_encode($data); 
$curl = curl_init($baseUrl . "/envelopes"); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 
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" 
)); 
$json_response = curl_exec($curl); 
echo "<pre>"; 
print_r($json_response); 
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE); 

if ($status != 201){ 
    print_r($json_response); 
    echo "\n"; 
    exit(-1); 
} 

$response = json_decode($json_response, true); 
$envelopeId = $response["envelopeId"]; 

// To add recipients in docusign 
$data1 = json_encode(array(
    "signers" => array(
     array(
      "email" => $email1, 
      "name" => 'jkl', 
      "roleName" => "Signer", 
      "recipientId" => 5000 
     ) 
    ) 
)); 
$curl = curl_init($baseUrl . "/envelopes/" . $envelopeId . "/recipients"); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json', 
    'Content-Length: ' . strlen($data1) , 
    "X-DocuSign-Authentication: $header" 
)); 
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($curl, CURLOPT_POSTFIELDS, $data1); 
$json_response = curl_exec($curl); 
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE); 
$response = json_decode($json_response, true); 
?> 
+0

이것은 Docusign 지원 팀이 후 나를 위해 일했습니다. –

답변

0

는 아래의 단계에 따라 예상대로 위의 코드가 작동합니다.

1. 데모 계좌에 로그인하십시오. 2. 역할 이름 만 남기고받는 사람 이름과 전자 메일을 제거하십시오.

관련 문제