Два подписанта с API в PHP примере - PullRequest
0 голосов
/ 23 февраля 2020

Я пытаюсь отправить один конверт с двумя или более подписавшими, но я не нашел, как я это делаю. Использование примера с одним подписавшим работает нормально, но как я могу добавить второго подписывающего в этом конверте?

после части кода: Объект подписывающего

$signer1 = new DocuSign\eSign\Model\Signer(['email' => $signerEmail1, 'name' => $signerName1, 'recipient_id' => "1", 'routing_order' => "1" ]);
***$signer2 = new DocuSign\eSign\Model\Signer(['email' => $signerEmail2, 'name' => $signerName2, 'recipient_id' => "2", 'routing_order' => "2" ]);***

# DocuSign SignHere field/tab object
$signHere1 = new DocuSign\eSign\Model\SignHere(['document_id' => '1', 'page_number' => '1', 'recipient_id' => '1',  'tab_label' => 'SignHereTab', 'x_position' => '195', 'y_position' => '147' ]);

Я пробовал это:

***$signHere2 = new DocuSign\eSign\Model\SignHere(['document_id' => '1', 'page_number' => '1', 'recipient_id' => '1',  'tab_label' => 'SignHereTab', 'x_position' => '195', 'y_position' => '147' ]);***

# Add the tabs to the signer object
# The Tabs object wants arrays of the different field/tab types
$signer1->setTabs(new DocuSign\eSign\Model\Tabs(['sign_here_tabs' => [$signHere1]])); 

Я пробовал это:

$signer2->setTabs(new DocuSign\eSign\Model\Tabs(['sign_here_tabs' => [$signHere2]])); 


# Next, create the top level envelope definition and populate it.
$envelopeDefinition = new DocuSign\eSign\Model\EnvelopeDefinition(['email_subject' => "Por favor assinar este documento",'documents' => [$document],  'recipients' => new DocuSign\eSign\Model\Recipients(['signers' => [$signer1]]) ,'status' => "sent"] );


#
#  Step 2. Create/send the envelope.
#
$config = new DocuSign\eSign\Configuration();
$config->setHost($basePath);
$config->addDefaultHeader("Authorization", "Bearer " . $accessToken);
$apiClient = new DocuSign\eSign\Client\ApiClient($config);
$envelopeApi = new DocuSign\eSign\Api\EnvelopesApi($apiClient);
$results = $envelopeApi->createEnvelope($accountId, $envelopeDefinition);
return $results;

};

Я использую последний пример: https://developers.docusign.com/esign-rest-api/code-examples/code-example-request-a-signature-via-email

1 Ответ

1 голос
/ 23 февраля 2020

Вкладки принадлежат подписавшимся. Вот решение:

# Untested code for two signers, each with one signHere tab

# The signer object
$signer = new DocuSign\eSign\Model\Signer([ 
    'email' => $signerEmail, 'name' => $signerName, 
    'recipient_id' => "1", 'routing_order' => "1"
]);

# Signer object #2
$signer2 = new DocuSign\eSign\Model\Signer([ 
    'email' => $signerEmail2, 'name' => $signerName2, 
    'recipient_id' => "2", 'routing_order' => "2"
]);

# DocuSign SignHere field/tab object
$signHere = new DocuSign\eSign\Model\SignHere([ 
    'document_id' => '1', 'page_number' => '1', 'recipient_id' => '1', 
    'tab_label' => 'SignHereTab', 'x_position' => '195', 'y_position' => '147'
]);

# DocuSign SignHere field/tab object #2
$signHere2 = new DocuSign\eSign\Model\SignHere([ 
    'document_id' => '1', 'page_number' => '1', 'recipient_id' => '2', 
    'tab_label' => 'SignHereTab', 'x_position' => '395', 'y_position' => '147'
]);

# Add the tabs to the signer objects
# The Tabs object wants arrays of the different field/tab types
$signer->setTabs(new DocuSign\eSign\Model\Tabs(
    ['sign_here_tabs' => [$signHere]])); 
$signer2->setTabs(new DocuSign\eSign\Model\Tabs(
    ['sign_here_tabs' => [$signHere2]])); 

# Next, create the top level envelope definition and populate it.
$envelopeDefinition = new DocuSign\eSign\Model\EnvelopeDefinition([
    'email_subject' => "Please sign this document",
    'documents' => [$document], # The order in the docs array determines the order in the envelope
    # The Recipients object wants arrays for each recipient type
    'recipients' => new DocuSign\eSign\Model\Recipients(
        ['signers' => [$signer, $signer2]]), 
    'status' => "sent" # requests that the envelope be created and sent.
]);
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...