2017-10-11 81 views
0

私はdocusign埋め込み記号で署名した2人のユーザを取得しようとしています。私はDocusign/githubによって与えられたサンプルコードを使用しています。最初の署名者が文書に署名したときにエンベロープIDを取得しようとしましたが、エラーが発生しました。 2番目の受信者に何か問題があるようです。誰かが助けるだろうか?埋め込み署名のマルチユーザ署名

$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を取得する際にエラーが発生していますか?私は、あなたは、あなたはSTEP2で123456としてclientuserIdとsigner2を作成しているが、STEP3で、手順2で12345

でclientUserIdでURLを取得しようとしている、あなたはSTEP3で

$signer2->setClientUserId('123456'); 

を持って見ることができますあなたはsigner2の正しいclientUserIdを設定した場合、私は問題があなたのために解決されるだろうと思いステップ2

$recipient_view_request->setClientUserId('12345'); 

に封筒に//

を渡している追加されました。

関連する問題