2017-10-11 7 views
0

docusign 임베디드 기호로 서명 한 2 명의 사용자를 얻으려고합니다. 나는 Docusign/github에 의해 주어진 예제 코드를 사용하고있다. 나는 두 번째 사용자가 첫 번째 사용자가 문서에 서명했는지 확인하고, 여기에 몇 가지 설명을 기반으로 첫 번째 서명자가 문서에 서명했을 때 봉투 ID를 얻으려고 시도하지만 오류가 발생합니다. 두 번째 수신자에 문제가있는 것으로 보입니다. 누군가 도움이 될까요?docusign 임베디드 서명의 멀티 서명자 문제

$username_docusign=$config['username_docusign']; 
$password_docusign=$config['password_docusign']; 
$integrator_key_docusign=$config['integrator_key_docusign']; 
$host_docusign=$config['host_docusign']; 
// create a new DocuSign configuration and assign host and header(s) 
$config = new DocuSign\eSign\Configuration(); 
$config->setSSLVerification(false); 
$config->setHost($host_docusign); 
$config->addDefaultHeader("X-DocuSign-Authentication", "{\"Username\":\"" . $username_docusign . "\",\"Password\":\"" . $password_docusign . "\",\"IntegratorKey\":\"" . $integrator_key_docusign . "\"}"); 
///////////////////////////////////////////////////////////////////////// 
// STEP 1: Login() API 
///////////////////////////////////////////////////////////////////////// 
// instantiate a new docusign api client 
$apiClient = new DocuSign\eSign\ApiClient($config); 
// we will first make the Login() call which exists in the AuthenticationApi... 
$authenticationApi = new DocuSign\eSign\Api\AuthenticationApi($apiClient); 
// optional login parameters 
$options = new \DocuSign\eSign\Api\AuthenticationApi\LoginOptions(); 
// call the login() API 
$loginInformation = $authenticationApi->login($options); 
// parse the login results 
if(isset($loginInformation) && count($loginInformation) > 0) 
{ 
    // note: defaulting to first account found, user might be a 
    // member of multiple accounts 
    $loginAccount = $loginInformation->getLoginAccounts()[0]; 
    if(isset($loginInformation)) 
    { 
     $accountId = $loginAccount->getAccountId(); 
     if(!empty($accountId)) 
     { 
      echo "Account ID = $accountId\n"; 
     } 
    } 
} 
///////////////////////////////////////////////////////////////////////// 
// STEP 2: Create & Send Envelope with Embedded Recipient 
///////////////////////////////////////////////////////////////////////// 
// set recipient information 
$recipientName = "user1"; 
$recipientEmail = "email1"; 
// configure the document we want signed 



$recipientName2 = "user2"; 
$recipientEmail2 = "email2"; 

$documentFileName = "hhhh.pdf"; 
$documentName = "hhhh.pdf"; 
// instantiate a new envelopeApi object 
$envelopeApi = new DocuSign\eSign\Api\EnvelopesApi($apiClient); 
// Add a document to the envelope 
$document = new DocuSign\eSign\Model\Document(); 
$document->setDocumentBase64(base64_encode(file_get_contents($document))); 
$document->setName($documentName); 
$document->setDocumentId("1"); 
// Create a |SignHere| tab somewhere on the document for the recipient to sign 
$signHere = new \DocuSign\eSign\Model\SignHere(); 

$signHere->setAnchorString("Sign here user1");//here my text in html 
$signHere->setAnchorXOffset("3"); 
$signHere->setAnchorYOffset("0"); 
$signHere->setAnchorUnits("inches"); 
$signHere->setPageNumber("1"); 
$signHere->setRecipientId("1"); 
// add the signature tab to the envelope's list of tabs 
$tabs = new DocuSign\eSign\Model\Tabs(); 
$tabs->setSignHereTabs(array($signHere)); 
// add a signer to the envelope 
$signer = new \DocuSign\eSign\Model\Signer(); 
$signer->setEmail($recipientEmail); 
$signer->setName($recipientName); 
$signer->setRecipientId("1"); 
$signer->setTabs($tabs); 
$signer->setClientUserId('12345'); 

$signHere2 = new \DocuSign\eSign\Model\SignHere(); 

$signHere2->setAnchorString("Sign here user2");//here my text in html 
$signHere2->setAnchorXOffset("3"); 
$signHere2->setAnchorYOffset("0"); 
$signHere2->setAnchorUnits("inches"); 
$signHere2->setPageNumber("1"); 
$signHere2->setRecipientId("2"); 
// add the signature tab to the envelope's list of tabs 
$tabs2 = new DocuSign\eSign\Model\Tabs(); 
$tabs2->setSignHereTabs(array($signHere2)); 
// add a signer to the envelope 
$signer2 = new \DocuSign\eSign\Model\Signer(); 
$signer2->setEmail($recipientEmail2); 
$signer2->setName($recipientName2); 
$signer2->setRecipientId("2"); 
$signer2->setTabs($tabs2); 
$signer2->setClientUserId('123456'); 





// must set this to embed the recipient! 
// Add a recipient to sign the document 
$recipients = new DocuSign\eSign\Model\Recipients(); 
$recipients->setSigners(array($signer),array($signer2)); 
$envelop_definition = new DocuSign\eSign\Model\EnvelopeDefinition(); 
$envelop_definition->setEmailSubject("oggetto mail"); 
// set envelope status to "sent" to immediately send the signature request 
$envelop_definition->setStatus("sent"); 
$envelop_definition->setRecipients($recipients); 
$envelop_definition->setDocuments(array($document)); 
// create and send the envelope! (aka signature request) 
$envelop_summary = $envelopeApi->createEnvelope($accountId, $envelop_definition, null); 

///////////////////////////////////////////////////////////////////////// 
// STEP 3: Request Recipient View (aka signing URL) 
///////////////////////////////////////////////////////////////////////// 
// instantiate a RecipientViewRequest object 
$recipient_view_request = new \DocuSign\eSign\Model\RecipientViewRequest(); 
// set where the recipient is re-directed once they are done signing 
$recipient_view_request->setReturnUrl("http://www.elevationworld.com/adr/embedded.php?iddocumento_firmato=".$_GET['iddocumento']."&idutente_firmato=".$_SESSION['email']."&enevelope=".$envelop_summary->getEnvelopeId()); 
// configure the embedded signer 
if ($_GET['enevelope']=="") { 
$recipient_view_request->setUserName($recipientName); 
$recipient_view_request->setEmail($recipientEmail); 
// must reference the same clientUserId that was set for the recipient when they 
// were added to the envelope in step 2 
$recipient_view_request->setClientUserId('12345'); 
// used to indicate on the certificate of completion how the user authenticated 
$recipient_view_request->setAuthenticationMethod("email"); 
// generate the recipient view! (aka embedded signing URL) 
$signingView = $envelopeApi->createRecipientView($accountId, $envelop_summary->getEnvelopeId(), $recipient_view_request); 
$signurl= $signingView->getUrl(); 
    } else { 
    $recipient_view_request->setUserName($recipientName2); 
$recipient_view_request->setEmail($recipientEmail2); 
// must reference the same clientUserId that was set for the recipient when they 
// were added to the envelope in step 2 
$recipient_view_request->setClientUserId('12345'); 
// used to indicate on the certificate of completion how the user authenticated 
$recipient_view_request->setAuthenticationMethod("email"); 
// generate the recipient view! (aka embedded signing URL) 
$signingView = $envelopeApi->createRecipientView($accountId, $_GET['enevelope'], $recipient_view_request); 
$signurl= $signingView->getUrl(); 

    } 
header('Location: '.$signurl); 

답변

1

서명자 2의 recipientURL을 가져 오는 중 오류가 발생 했습니까? , 당신은 STEP3에서

$signer2->setClientUserId('123456'); 

이 당신을 당신이 STEP2에서 123456로 clientuserId로 signer2를 만든 볼 수 있지만 STEP3, 당신은 2 단계에서 12345

와 clientUserId로 URL을 얻기 위해 노력하고있다 당신이 signer2에 대한 올바른 clientUserId을 설정하면

을 전달하는 // 나는이 문제가 당신을 위해 해결 될 것이라고 생각 2 단계

$recipient_view_request->setClientUserId('12345'); 

에 봉투에 추가되었습니다.