php 通过电子邮件在Laravel进行Docusign远程签名

iecba09b  于 2023-02-18  发布在  PHP
关注(0)|答案(1)|浏览(121)

我想在laravel中通过电子邮件请求docusign远程签名。

有人能给我这个的密码吗?

3duebb1j

3duebb1j1#

https://github.com/docusign/code-examples-php/blob/master/src/Services/Examples/eSignature/SigningViaEmailService.php有代码向您展示如何执行此操作。
相关的PHP代码如下:

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);
    }

相关问题