public static function make_envelope(array $args, $clientService, $demoDocsPath, $docxFile, $pdfFile): EnvelopeDefinition
{
$envelope_definition = new EnvelopeDefinition([
'email_subject' => 'Please sign this document set'
]);
$doc1_b64 = base64_encode($clientService->createDocumentForEnvelope($args));
# read files 2 and 3 from a local directory
# The reads could raise an exception if the file is not available!
$content_bytes = file_get_contents($demoDocsPath . $docxFile);
$doc2_b64 = base64_encode($content_bytes);
$content_bytes = file_get_contents($demoDocsPath . $pdfFile);
$doc3_b64 = base64_encode($content_bytes);
$document1 = new Document([ # create the DocuSign document object
'document_base64' => $doc1_b64,
'name' => 'Order acknowledgement', # can be different from actual file name
'file_extension' => 'html', # many different document types are accepted
'document_id' => '1' # a label used to reference the doc
]);
$document2 = new Document([ # create the DocuSign document object
'document_base64' => $doc2_b64,
'name' => 'Battle Plan', # can be different from actual file name
'file_extension' => 'docx', # many different document types are accepted
'document_id' => '2' # a label used to reference the doc
]);
$document3 = new Document([ # create the DocuSign document object
'document_base64' => $doc3_b64,
'name' => 'Lorem Ipsum', # can be different from actual file name
'file_extension' => 'pdf', # many different document types are accepted
'document_id' => '3' # a label used to reference the doc
]);
# The order in the docs array determines the order in the envelope
$envelope_definition->setDocuments([$document1, $document2, $document3]);
# Create the signer recipient model
$signer1 = new Signer([
'email' => $args['signer_email'], 'name' => $args['signer_name'],
'recipient_id' => "1", 'routing_order' => "1"]);
$cc1 = new CarbonCopy([
'email' => $args['cc_email'], 'name' => $args['cc_name'],
'recipient_id' => "2", 'routing_order' => "2"]);
return SMSDeliveryService::addSignersToTheDelivery($signer1, $cc1, $envelope_definition, $args);
}
1条答案
按热度按时间3duebb1j1#
https://github.com/docusign/code-examples-php/blob/master/src/Services/Examples/eSignature/SigningViaEmailService.php有代码向您展示如何执行此操作。
相关的PHP代码如下: