Skip to content

Commit 6cdb9f4

Browse files
authored
Merge pull request #150 from docusign/embeded-sending
Embedded sending example updates
2 parents 4b5cb34 + a4c558a commit 6cdb9f4

File tree

4 files changed

+96
-46
lines changed

4 files changed

+96
-46
lines changed

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
},
1616
"description": "DocuSign PHP launcher",
1717
"require": {
18-
"docusign/admin-client": "^1.4.2",
19-
"docusign/click-client": "^1.4.1",
20-
"docusign/esign-client": "^6.19.0",
21-
"docusign/rooms-client": "^2.1.1",
22-
"docusign/monitor-client": "^1.2.1",
23-
"docusign/webforms-client": "^1.0.1",
24-
"docusign/maestro-client": "^1.0.0",
18+
"docusign/admin-client": "^1.4.2-rc1",
19+
"docusign/click-client": "^1.4.1-rc1",
20+
"docusign/esign-client": "^7.0.0-rc1",
21+
"docusign/rooms-client": "^2.1.1-rc1",
22+
"docusign/monitor-client": "^1.2.1-rc1",
23+
"docusign/webforms-client": "^1.0.1-rc1",
24+
"docusign/maestro-client": "v1.0.0-rc1",
2525
"twig/twig": "^3.9.3",
2626
"league/oauth2-client": "^2.7.0",
2727
"ext-json": "*",

composer.lock

Lines changed: 43 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Services/Examples/eSignature/EmbeddedSendingService.php

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
namespace DocuSign\Services\Examples\eSignature;
44

5-
use DocuSign\eSign\Model\ReturnUrlRequest;
5+
use DocuSign\eSign\Model\EnvelopeViewRecipientSettings;
6+
use DocuSign\eSign\Model\EnvelopeViewDocumentSettings;
7+
use DocuSign\eSign\Model\EnvelopeViewTaggerSettings;
8+
use DocuSign\eSign\Model\EnvelopeViewTemplateSettings;
9+
use DocuSign\eSign\Model\EnvelopeViewRequest;
10+
use DocuSign\eSign\Model\EnvelopeViewSettings;
611

712
class EmbeddedSendingService
813
{
@@ -30,7 +35,7 @@ public static function embeddedSending(array $args, $clientService, $demoDocsPat
3035

3136
# Create sender view
3237
#ds-snippet-start:eSign11Step3
33-
$view_request = new ReturnUrlRequest(['return_url' => $args['ds_return_url']]);
38+
$view_request = EmbeddedSendingService::prepareViewRequest($args['starting_view'], $args['ds_return_url']);
3439
$envelope_api = $clientService->getEnvelopeApi();
3540
$senderView = $envelope_api->createSenderView($args['account_id'], $envelope_id, $view_request);
3641

@@ -43,4 +48,41 @@ public static function embeddedSending(array $args, $clientService, $demoDocsPat
4348
return ['envelope_id' => $envelope_id, 'redirect_url' => $url];
4449
#ds-snippet-end:eSign11Step3
4550
}
51+
52+
private static function prepareViewRequest(string $startingView, string $returnUrl): EnvelopeViewRequest
53+
{
54+
$viewSettings = new EnvelopeViewSettings([
55+
'starting_screen' => $startingView,
56+
'send_button_action' => 'send',
57+
'show_back_button' => 'false',
58+
'back_button_action' => 'previousPage',
59+
'show_header_actions' => 'false',
60+
'show_discard_action' => 'false',
61+
'lock_token' => '',
62+
'recipient_settings' => new EnvelopeViewRecipientSettings([
63+
'show_edit_recipients' => 'false',
64+
'show_contacts_list' => 'false'
65+
]),
66+
'document_settings' => new EnvelopeViewDocumentSettings([
67+
'show_edit_documents' => 'false',
68+
'show_edit_document_visibility' => 'false',
69+
'show_edit_pages' => 'false',
70+
]),
71+
'tagger_settings' => new EnvelopeViewTaggerSettings([
72+
'palette_sections' => 'default',
73+
'palette_default' => 'custom'
74+
]),
75+
'template_settings' => new EnvelopeViewTemplateSettings([
76+
'show_matching_templates_prompt' => 'true'
77+
])
78+
]);
79+
80+
$viewRequest = new EnvelopeViewRequest([
81+
'return_url' => $returnUrl,
82+
'view_access' => 'envelope',
83+
'settings' => $viewSettings
84+
]);
85+
86+
return $viewRequest;
87+
}
4688
}

templates/esignature/eg011_embedded_sending.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ <h4>{{ code_example_text['ExampleName'] | raw }}</h4>
4545
</label>
4646

4747
<select id="starting_view" name="starting_view" class="form-control">
48-
<option value="tagging" selected>Tagging view</option>
49-
<option value="recipient">Recipient &amp; Documents view</option>
48+
<option value="Tagger" selected>Tagging view</option>
49+
<option value="Prepare">Prepare view</option>
5050
</select>
5151
</div>
5252
<div class="form-group">

0 commit comments

Comments
 (0)